QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#522061 | #7046. Function! | yaLen# | WA | 0ms | 3740kb | C++14 | 1.5kb | 2024-08-16 18:00:36 | 2024-08-16 18:00:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fuck cout << "fuck "
#define _ << ' ' <<
#define __ << ' '
#define __l << '\n'
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define Mod(x) ((x) % MOD + MOD) % MOD
#define int long long
#define append push_back
const int INF = 6452864528;
const int N = 1e5 + 10;
const int MatN = 3;
const int MOD = 998244353;
int tin, tinn, tinnn, tmp;
string stin, stinn, stinnn;
int itr;
// ---
// ---
int qpow(int a, int b, int p)
{
int res = 1;
while (b)
{
if (b & 1)
res = res * a % p;
a = a * a % p;
b >>= 1;
}
return res;
}
void solve()
{
int n;
cin >> n;
int ans = 0, zns = n % MOD;
// for(int n=2;n<100;n++){
int res = 0;
for (int a = 2; a <= n; a++)
{
int tmp = a;
int exp = 1;
int ares = 0;
if (a * a > n)
{
break;
}
while (tmp * a <= n)
{
ares -= exp * tmp;
tmp *= a;
ares += exp * tmp;
exp++;
}
zns = (zns % MOD + a % MOD * (n - a + 1) % MOD);
ares = (ares + exp * (n + 1 - tmp)) % MOD;
ares = (ares * a) % MOD;
// cout<<a _ ares<<endl;
res = (res + ares) % MOD;
}
ans = n % MOD * (n + 1) % MOD * (n + 2) % MOD * qpow(6, MOD - 2, MOD) %MOD;
cout << ((ans % MOD + res % MOD) % MOD - zns + MOD) % MOD << endl;
// }
}
signed main()
{
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
// cout<<fixed<<setprecision(3);
signed o_O = 1;
// cin>>o_O;
while (o_O--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3564kb
input:
2
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
10
output:
236
result:
ok 1 number(s): "236"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
20
output:
1646
result:
ok 1 number(s): "1646"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
27
output:
3862
result:
ok 1 number(s): "3862"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
37
output:
9571
result:
ok 1 number(s): "9571"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
100
output:
175028
result:
ok 1 number(s): "175028"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
123
output:
322744
result:
ok 1 number(s): "322744"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
2548
output:
765669726
result:
ok 1 number(s): "765669726"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
12448
output:
159637196
result:
ok 1 number(s): "159637196"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
65535
output:
120089112
result:
ok 1 number(s): "120089112"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
102458
output:
475774506
result:
ok 1 number(s): "475774506"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
222333
output:
64337543
result:
ok 1 number(s): "64337543"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
485174
output:
312492357
result:
ok 1 number(s): "312492357"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
685479
output:
35530508
result:
ok 1 number(s): "35530508"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
1025481
output:
921523794
result:
ok 1 number(s): "921523794"
Test #16:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
9999999
output:
-265633944
result:
wrong answer 1st numbers differ - expected: '732610409', found: '-265633944'