QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#619594 | #8339. Rooted Tree | lzy | WA | 0ms | 3604kb | C++14 | 615b | 2024-10-07 14:44:41 | 2024-10-07 14:44:41 |
Judging History
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;
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,siz2=1;
for(int i=1;i<=k;i++){
av=leave*qpow(siz2,mod-2)%mod;
int t=((av+1)*n)%mod;
sum=(sum+t)%mod;
leave=(leave+t-av+mod)%mod;
siz2=(i*(n-1))%mod;
}
cout<<sum<<"\n";
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3604kb
input:
6 2
output:
200000021
result:
wrong answer 1st numbers differ - expected: '18', found: '200000021'