QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#139045#5661. Multi-Laddershano#WA 1ms3536kbC++20839b2023-08-12 17:00:292023-08-12 17:00:29

Judging History

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

  • [2023-08-12 17:00:29]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3536kb
  • [2023-08-12 17:00:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;

ll sq(ll x){
	return (x*x)%mod;
}
ll bin(ll a,ll b){
	if(b==0)return 1;
	if(b&1){
		return (a*sq(bin(a,b>>1)))%mod;
	}
	return sq(bin(a,b>>1))%mod;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int t;
	cin>>t;
	while(t--){
		ll n,k,l;cin>>n>>k>>l;
		if(k%2 && l==2){	
			cout<<0<<endl;
			continue;
		}
		if(l<2){
			cout<<0<<endl;
			continue;
		}
		ll ans=l*(l-2);
		ans%=mod;
		ans*=bin(l-1,k-2);
		ans%=mod;
		if(k!=3)ans+=(l*bin(l-1,k-1))%mod,ans%=mod;
		if(n==1){
			cout<<ans<<endl;
			continue;
		}
		ll hnhn=(l-2)*(l-3);
		hnhn%=mod;
		hnhn+=(l-1)*2-1;
		hnhn%=mod;
		hnhn*=(n-1);
		hnhn%=mod;
		ans*=bin(hnhn,k);
		ans%=mod;
		cout<<ans<<endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3484kb

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3536kb

input:

20
2 3 3
1 3 3
10 3 0
10 3 2
1 21 2
1 22 0
2000 15000 2000
12000 30000 200000
1000000000 3 3
2 1000000000 3
2 3 100000000
1000000000 1000000000 10
1000000000 3 100000000
2 1000000000 100000000
1 1000000000 10
1 1000000000 100000000
1 1000 100000000
1000000000 1000000000 0
1000000000 1000000000 1
100...

output:

162
6
0
0
0
0
557437578
182567899
999917063
559076007
176686901
513089067
536307325
534772680
392828158
852541271
861467105
0
0
918001314

result:

wrong answer 7th lines differ - expected: '349400141', found: '557437578'