QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#152598 | #5661. Multi-Ladders | ftt_fan_club# | WA | 1ms | 3588kb | C++14 | 488b | 2023-08-28 13:35:32 | 2023-08-28 13:35:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
int T,n,k,c;
int pw(int x,int p){
int bs=1;
while(p){
if(p&1)bs=bs*x%mod;
x=x*x%mod;p>>=1;
}return bs;
}signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cin>>T;
while(T--){
cin>>n>>k>>c;
if(!c){
cout<<"0\n";
continue;
}int ans=(pw(c-1,k)+pw(mod-1,k)*(c-1))%mod;
ans=ans*pw(((c-1)*(c-1)-(c-2)+mod)%mod,k*(n-1)%(mod-1));
cout<<ans<<"\n";
}return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3588kb
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 9656738416997307 665110613898784922 3052489902 33179013285943935 414616160079000000 538813528989798040 228679446159000000 140836836977753056 693053429 883715672 80402569 0 0 753887490588965208
result:
wrong answer 7th lines differ - expected: '349400141', found: '9656738416997307'