QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#300786 | #5817. 小学生数学题 | ebofan# | 20 | 949ms | 3648kb | C++14 | 423b | 2024-01-08 20:04:22 | 2024-07-04 03:17:03 |
Judging History
answer
#include<iostream>
#define ll long long
using namespace std;
constexpr ll p = 998244353;
int k;
ll n,ans;
ll jc = 1,fm;
ll mypow(ll x,int tms){
ll ans = 1;
while(tms){
if(tms&1) ans = ans*x%p;
x=x*x%p;
tms>>=1;
}
return ans;
}
int main(){
cin>>n>>k;
for(int i=1;i<=n;i++){
jc = jc*i%p;
fm = mypow(mypow(i,k),p-2);
ans += jc * fm % p;
ans %= p;
}
cout<<ans<<endl;
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: 850ms
memory: 3648kb
input:
7081118 3
output:
599009773
result:
ok single line: '599009773'
Test #5:
score: 10
Accepted
time: 949ms
memory: 3632kb
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