QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#619611#8339. Rooted TreelzyWA 0ms3688kbC++14599b2024-10-07 14:47:482024-10-07 14:47:48

Judging History

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

  • [2024-10-07 14:47:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3688kb
  • [2024-10-07 14:47:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int mod=1e9+9;
int qpow(int a,int b){
    int res=1;
    a%=mod;
    while(b){
        if(b&1)res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
signed main() {
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,k;
    cin>>n>>k;
    int av;
    int sum=0,leave=0;
    for(int i=1;i<=k;i++){
        av=leave*qpow((i*(n-1)+1),mod-2)%mod;
        int t=((av+1)*n)%mod;
        sum=(sum+t)%mod;
        leave=(leave+t-av+mod)%mod;
    }
    cout<<sum<<"\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3688kb

input:

6 2

output:

90909107

result:

wrong answer 1st numbers differ - expected: '18', found: '90909107'