F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_39600750_31395.cpp: In function 'long long int mod_inverse(long long int, long long int)':
0_0_39600750_31395.cpp:5:194: error: too few arguments to function 'long long int fast_pow(long long int, long long int, int)'
    5 | const int N=1e5;const int mod=1e9+7;ll sum[N],mul[N];ll fast_pow(ll x,ll y,int m){ll res=1;while(y){if(y&1)res*=x,res%=m;x=(x*x)%m;y>>=1;}return res;}ll mod_inverse(ll a,ll mod){return fast_pow( );}void init(){sum[1]=0;mul[1]=1;for(int i=2;i<=N;i++){sum[i]=sum[i-1]+i;mul[i]=(i*mul[i-1]%mod;}}int main(){init();int T;scanf("%d",&T);while (T--){int x;scanf("%d",&x);if(x==1){puts("1");continue;}int k=upper_bound(sum+1,sum+1+N,x)-sum-1;int m=x-sum[k];ll ans;if(k==m)ans=ans=mul[k]*mod_inverse(2,mod)%mod*(k+2)%mod;else ans=mul[k+1]*mod_inverse(k-m+1,mod)%mod%mod;printf("%lld",ans);}return 0;}
      |                                                                                                                                                                                          ~~~~~~~~^~~
0_0_39600750_31395.cpp:5:57: note: declared here
    5 | const int N=1e5;const int mod=1e9+7;ll sum[N],mul[N];ll fast_pow(ll x,ll y,int m){ll res=1;while(y){if(y&1)res*=x,res%=m;x=(x*x)%m;y>>=1;}return res;}ll mod_inverse(ll a,ll mod){return fast_pow( );}void init(){sum[1]=0;mul[1]=1;for(int i=2;i<=N;i++){sum[i]=sum[i-1]+i;mul[i]=(i*mul[i-1]%mod;}}int main(){init();int T;scanf("%d",&T);while (T--){int x;scanf("%d",&x);if(x==1){puts("1");continue;}int k=upper_bound(sum+1,sum+1+N,x)-sum-1;int m=x-sum[k];ll ans;if(k==m)ans=ans=mul[k]*mod_inverse(2,mod)%mod*(k+2)%mod;else ans=mul[k+1]*mod_inverse(k-m+1,mod)%mod%mod;printf("%lld",ans);}return 0;}
      |                                                         ^~~~~~~~
0_0_39600750_31395.cpp: In function 'void init()':
0_0_39600750_31395.cpp:5:291: error: expected ')' before ';' token
    5 | const int N=1e5;const int mod=1e9+7;ll sum[N],mul[N];ll fast_pow(ll x,ll y,int m){ll res=1;while(y){if(y&1)res*=x,res%=m;x=(x*x)%m;y>>=1;}return res;}ll mod_inverse(ll a,ll mod){return fast_pow( );}void init(){sum[1]=0;mul[1]=1;for(int i=2;i<=N;i++){sum[i]=sum[i-1]+i;mul[i]=(i*mul[i-1]%mod;}}int main(){init();int T;scanf("%d",&T);while (T--){int x;scanf("%d",&x);if(x==1){puts("1");continue;}int k=upper_bound(sum+1,sum+1+N,x)-sum-1;int m=x-sum[k];ll ans;if(k==m)ans=ans=mul[k]*mod_inverse(2,mod)%mod*(k+2)%mod;else ans=mul[k+1]*mod_inverse(k-m+1,mod)%mod%mod;printf("%lld",ans);}return 0;}
      |                                                                                                                                                                                                                                                                                    ~              ^
      |                                                                                                                                                                                                                                                                                                   )


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-26 09:46:30, Gzip enabled