QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#199966 | #7046. Function! | lyzqs# | WA | 0ms | 3720kb | C++14 | 771b | 2023-10-04 14:49:47 | 2023-10-04 14:49:47 |
Judging History
answer
#include <bits/stdc++.h>
#define il inline
#define ll long long
#define int ll
#define Max 200005
using namespace std;
il ll read()
{
char c=getchar();
ll x=0,f=1;
while(c>'9'||c<'0')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=x*10+c-'0';
c=getchar();
}
return x*f;
}
#define Mod 998244353
int n;
signed main()
{
n=read();
int ans=0;
int i;
for(i=2;i*i<=n;i++)
{
int l=i,r=i*i-1,nw=1;
while(l<=n)
{
ans=(ans+(min(r,n)-l+1)*nw%Mod*i%Mod)%Mod;
nw++,l=l*i,r=l*i-1;
}
}
// cout<<res<<"\n";
//i:i*(n-i)
int res=(n+i)*(n-i+1)/2%Mod*(n+1)%Mod;
//cout<<res<<"\n";
res=(res-(n*(n+1)*(2*n+1)/6)+((i-1)*(i)*(2*(i-1)+1)/6))%Mod;
res=(res+Mod)%Mod;
cout<<(res+ans)%Mod<<"\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
2
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10
output:
236
result:
ok 1 number(s): "236"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
20
output:
1646
result:
ok 1 number(s): "1646"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
27
output:
3862
result:
ok 1 number(s): "3862"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
37
output:
9571
result:
ok 1 number(s): "9571"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
100
output:
175028
result:
ok 1 number(s): "175028"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
123
output:
322744
result:
ok 1 number(s): "322744"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2548
output:
765669726
result:
ok 1 number(s): "765669726"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
12448
output:
159637196
result:
ok 1 number(s): "159637196"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
65535
output:
120089112
result:
ok 1 number(s): "120089112"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
102458
output:
475774506
result:
ok 1 number(s): "475774506"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
222333
output:
64337543
result:
ok 1 number(s): "64337543"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
485174
output:
312492357
result:
ok 1 number(s): "312492357"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
685479
output:
35530508
result:
ok 1 number(s): "35530508"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
1025481
output:
921523794
result:
ok 1 number(s): "921523794"
Test #16:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
9999999
output:
539390788
result:
wrong answer 1st numbers differ - expected: '732610409', found: '539390788'