QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#287964 | #5817. 小学生数学题 | Haoyue_06432 | 20 | 942ms | 3696kb | C++14 | 461b | 2023-12-21 13:20:46 | 2023-12-21 13:20:48 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e18
#define mod 998244353
using namespace std;
ll n,m,ans1=1,ans2,ans;
ll ksm(ll x,ll y)
{
ll ans=1;
while(y)
{
if(y%2==1)ans=(ans*x)%mod;
x=(x*x)%mod;
y/=2;
}
return ans;
}
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
{
ans1=(ans1*i)%mod;
ans2=ksm(i,m);
ans=(ans+(ans1*ksm(ans2,mod-2))%mod)%mod;
}
cout<<ans;
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
9450395 1
output:
688545438
result:
Test #2:
score: 0
Time Limit Exceeded
input:
8978812 1
output:
334565356
result:
Test #3:
score: 0
Time Limit Exceeded
input:
8944235 1
output:
982802915
result:
Test #4:
score: 10
Accepted
time: 843ms
memory: 3596kb
input:
7081118 3
output:
599009773
result:
ok single line: '599009773'
Test #5:
score: 10
Accepted
time: 942ms
memory: 3696kb
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