QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650381#8339. Rooted Treezxg2333#Compile Error//C++17573b2024-10-18 14:54:332024-10-18 14:54:35

Judging History

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

  • [2024-10-18 14:54:35]
  • 评测
  • [2024-10-18 14:54:33]
  • 提交

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);
      |     ~~~~~^~~~~~~~~~~~~~