QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214634#5661. Multi-LaddersAnthonyQwO#WA 0ms3652kbC++14658b2023-10-14 22:08:442023-10-14 22:08:45

Judging History

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

  • [2023-10-14 22:08:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2023-10-14 22:08:44]
  • 提交

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, res, last;
        cin>>n>>k>>y;
        if(k == 3) last = (y-1)*(y-2);
        else last = (y-1)+(y-2)*(y-2);
        if( y == 0 || y == 1 ) cout<<0<<'\n'; 
        else cout << y*(last)% MOD*qpow((y-1),(k-3))% MOD*qpow(qpow(((y-1)+(y-2)*(y-2)% MOD)% MOD, n-1), k) % MOD<<'\n';
    }
}

详细

Test #1:

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

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

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
2
0
164845369
945582174
52489881
779538007
596768072
967595532
617448707
659457370
429257881
896065397
407795774
0
0
7875496

result:

wrong answer 5th lines differ - expected: '0', found: '2'