QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#677586 | #5661. Multi-Ladders | Forever_Young# | AC ✓ | 0ms | 3860kb | C++23 | 735b | 2024-10-26 13:00:54 | 2024-10-26 13:00:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define data dataa
using LL=long long;
using ULL=unsigned long long;
using LD=long double;
#define gcd(x,y) __gcd(unsigned(x),unsigned(y))
const int MOD=int(1e9)+7;
int mypow(int x,LL n){int res=1;for(;n;n>>=1,x=LL(x)*x%MOD)if(n&1)res=LL(res)*x%MOD;return res;}
int main()
{
int T;
for(scanf("%d",&T);T--;)
{
int n,k,l;
scanf("%d%d%d",&n,&k,&l);
if(l<=1){puts("0");continue;}
int ans=(mypow(l-1,k)+((k&1)?-1:1)*(l-1)+MOD)%MOD;
ans=LL(ans)*mypow((LL(l)*l-3ll*l+3)%MOD,LL(n-1)*k)%MOD;
printf("%d\n",ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
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 349400141 243010659 52489881 53690844 176686901 218103365 558243892 991895211 693053429 883715672 80402569 0 0 311752813
result:
ok 20 lines