QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#287346 | #5817. 小学生数学题 | UZING | 40 | 997ms | 3672kb | C++14 | 401b | 2023-12-20 13:07:57 | 2023-12-20 13:07:58 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int n,k;
long long ans;
int qpow(long long x,long long y)
{
long long ans=1;
while(y)
{
if(y%2)ans*=x,ans%=mod;
x*=x,x%=mod,y/=2;
}
return ans;
}
int main()
{
cin>>n>>k;
long long s=1;
for(int i=1;i<=n;i++)
{
s*=i,s%=mod;
ans+=s*qpow(qpow(i,k),mod-2),ans%=mod;
}
cout<<ans;
return 0;
}
詳細信息
Test #1:
score: 0
Time Limit Exceeded
input:
9450395 1
output:
688545438
result:
Test #2:
score: 10
Accepted
time: 997ms
memory: 3544kb
input:
8978812 1
output:
334565356
result:
ok single line: '334565356'
Test #3:
score: 10
Accepted
time: 990ms
memory: 3608kb
input:
8944235 1
output:
982802915
result:
ok single line: '982802915'
Test #4:
score: 10
Accepted
time: 825ms
memory: 3668kb
input:
7081118 3
output:
599009773
result:
ok single line: '599009773'
Test #5:
score: 10
Accepted
time: 920ms
memory: 3672kb
input:
7904241 3
output:
871243720
result:
ok single line: '871243720'
Test #6:
score: 0
Time Limit Exceeded
input:
9921275 3
output:
result:
Test #7:
score: 0
Time Limit Exceeded
input:
17575748 14135489
output:
result:
Test #8:
score: 0
Time Limit Exceeded
input:
19858362 14822524
output:
result:
Test #9:
score: 0
Time Limit Exceeded
input:
18848696 15530895
output:
result:
Test #10:
score: 0
Time Limit Exceeded
input:
17787945 13890407