QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#214555#5661. Multi-LaddersAnthonyQwO#WA 0ms3640kbC++14529b2023-10-14 21:07:012023-10-14 21:07:01

Judging History

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

  • [2023-10-14 21:07:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2023-10-14 21:07:01]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MOD=1e9+7;

int qpow( int n, int k ) {
    int res=1;
    for( ; k ; n=n*n%MOD, k>>=1 ) if( k&1 ) res=res*n%MOD;
    return res;
}

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int q;
    cin>>q;
    for(;q--;) {
        int n, k ,y;
        cin>>n>>k>>y;
        int res=y*(y-2)%MOD*qpow((y-1),(k-2))%MOD*qpow(qpow(((y-1)+(y-2)*(y-2)%MOD)%MOD, n-1), k) % MOD;
        cout<<res<<'\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3604kb

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
388318872
891305474
52489881
186358669
176686901
502286001
558243892
873610512
67213250
423049
869536635
0
0
145046875

result:

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