QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#139038 | #5661. Multi-Ladders | hano# | WA | 1ms | 3584kb | C++20 | 827b | 2023-08-12 16:48:59 | 2023-08-12 16:49:01 |
Judging History
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%2==0)ans+=(l*bin(l-1,k-1))%mod,ans%=mod;
if(n==1){
cout<<ans<<endl;
continue;
}
ll hnhn=(l-2)*(l-3);
hnhn+=(l-1)*2-1;
hnhn%=mod;
hnhn*=(n-1);
hnhn%=mod;
ans*=bin(hnhn,k);
ans%=mod;
cout<<ans<<endl;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3460kb
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'