QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#138991#5661. Multi-Laddershano#WA 1ms3532kbC++20772b2023-08-12 15:40:562023-08-12 15:51:30

Judging History

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

  • [2023-08-12 15:51:30]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3532kb
  • [2023-08-12 15:40:56]
  • 提交

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;
		if(k%2){
			ans*=(l-2);
			ans%=mod;
		}
		ans%=mod;
		ans*=bin(l-1,k-2);
		ans%=mod;
		if(k%2==0){
			ans*=(l-1);
			ans%=mod;
		}
		ll hnhn=(l-2)*(l-3);
		hnhn+=(l-1)*2-1;
		ans*=bin(hnhn,k);
		ans%=mod;
		cout<<ans<<endl;
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3532kb

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

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
162
0
0
0
0
266764082
236578485
162
372717338
285987160
469114305
285987160
601929983
469114305
601929983
164013240
0
0
601929983

result:

wrong answer 2nd lines differ - expected: '6', found: '162'