QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#719139#5817. 小学生数学题Wei_Han60 156ms160716kbC++231.2kb2024-11-06 22:42:442024-11-06 22:42:45

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 22:42:45]
  • 评测
  • 测评结果:60
  • 用时:156ms
  • 内存:160716kb
  • [2024-11-06 22:42:44]
  • 提交

answer

#include<bits/stdc++.h>
#define INF 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define pr putchar('\n')
#define pp putchar(' ')
#define pii pair<ll,ll>
#define pdi pair<ll,ll>
#define mem(aa,bb) memset(aa,bb,sizeof(aa))
#define fo(a,i,b) for(register ll i = a ; i <= b ; ++ i )
#define Fo(a,i,b) for(register ll i = a ; i >= b ; -- i )
#define fi first
#define se second
#define pb push_back
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
//typedef int ll;
//typedef __int128 ll;
typedef double db;
const int N=2e7+5,M=2e6+5;
inline void read(ll &opp){ll x=0,t=1;char ch;ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-'){t=-1;}ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}opp=x*t;return; }
inline void wr(ll x){if(x<0){putchar('-');x=-x;}if(x>9){wr(x/10);}putchar(x%10+'0');}
ll n,k,pre[N],fac[N],suf[N],num=1;
const ll mod=998244353;
inline ll qpow(ll a,ll b){return (!b?1:qpow(a*a%mod,b>>1)*((b&1)?a:1)%mod);}
signed main(){
	read(n),read(k);pre[0]=1;fo(1,i,n) pre[i]=pre[i-1]*i%mod,num=num*i%mod;fac[n]=n;fac[n+1]=1;Fo(n-1,i,1) fac[i]=fac[i+1]*i%mod;
	ll sum=0;fo(1,i,n) sum=(sum+pre[i]*qpow(pre[i-1]*fac[i+1]%mod,k)%mod)%mod;wr(sum*qpow(qpow(pre[n],k),mod-2)%mod),pr;
	return 0; 
}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 108ms
memory: 153360kb

input:

9450395 1

output:

688545438

result:

ok single line: '688545438'

Test #2:

score: 10
Accepted
time: 106ms
memory: 145884kb

input:

8978812 1

output:

334565356

result:

ok single line: '334565356'

Test #3:

score: 10
Accepted
time: 101ms
memory: 145184kb

input:

8944235 1

output:

982802915

result:

ok single line: '982802915'

Test #4:

score: 10
Accepted
time: 115ms
memory: 117924kb

input:

7081118 3

output:

599009773

result:

ok single line: '599009773'

Test #5:

score: 10
Accepted
time: 133ms
memory: 130388kb

input:

7904241 3

output:

871243720

result:

ok single line: '871243720'

Test #6:

score: 10
Accepted
time: 156ms
memory: 160716kb

input:

9921275 3

output:

549818101

result:

ok single line: '549818101'

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

output:


result: