QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#650381 | #8339. Rooted Tree | zxg2333# | Compile Error | / | / | C++17 | 573b | 2024-10-18 14:54:33 | 2024-10-18 14:54:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int P=1e9+9,M=1e7+1;
int ksm(int a,int b){
int res=1;
while(b){
if(b&1)res=res*1ll*a%P;
b>>=1;
a=a*1ll*a%P;
}
return res;
}
int ni(int a){
return ksm(a,P-2);
}
int m,k,cnt[M],ans;
int main(){
scanf("%d%d",&m,&k);
cnt[0]=1;
for(int i=1;i<=k;i++)cnt[i]=cnt[i-1]+m-12 5;
int sd=0;
for(int i=1;i<=k;i++){
ans=(ans+(sd+1)*1ll*m)%P;
sd=(sd*1ll*(cnt[i-1]-1)+(sd+1)*1ll*m)%P*1ll*ni(cnt[i])%P;
}
printf("%d\n",ans);
}
Details
answer.code: In function ‘int main()’: answer.code:20:46: error: expected ‘;’ before numeric constant 20 | for(int i=1;i<=k;i++)cnt[i]=cnt[i-1]+m-12 5; | ^~ | ; answer.code:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d%d",&m,&k); | ~~~~~^~~~~~~~~~~~~~