QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#617478#8339. Rooted TreelzyWA 0ms3608kbC++14745b2024-10-06 15:48:422024-10-06 15:48:42

Judging History

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

  • [2024-10-06 15:48:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3608kb
  • [2024-10-06 15:48:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int N = 1e6 + 5;
int a[N];
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;
}
void solve() {
	int n,k;
	cin>>n>>k;
	ll av,sum=0;
//	cout<<34*qpow(3,mod-2)%mod<<"&\n";
	ll leave=0,siz1=1,siz2=1;
	for(int i=1;i<=k;i++){
		av=leave*qpow(siz2,mod-2)%mod;
		sum=(sum+n*(av+1)%mod)%mod;
		leave=(leave+n*(av+1)%mod-av+mod)%mod;
		siz1=(siz1+n)%mod;
		siz2=(siz2+n-1)%mod;
	}
	cout<<sum<<"\n";
//	cout<<siz1<<" "<<siz2<<"&\n";
	
}
signed main() {
	IOS;
	int t = 1;
//	cin>>t;
	while (t--) {
		solve();
	}
}

详细

Test #1:

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

input:

6 2

output:

12

result:

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