QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#239117 | #5661. Multi-Ladders | ItsJerr# | WA | 1ms | 3588kb | C++20 | 609b | 2023-11-04 18:41:25 | 2023-11-04 18:41:26 |
Judging History
answer
/*input
2
2 3 3
1000000000 1000000000 3
*/
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e9 + 7;
int pw(int a, int b)
{
if (b == 1) return a;
if (b == 0) return 1;
int mid = pw(a, b / 2);
mid = mid * mid % mod;
if (b & 1) return mid * a % mod;
return mid;
}
main() {
cin.tie(0)->sync_with_stdio(0);
int t;
cin >> t;
while (t-- > 0)
{
int n, k, A;
cin >> n >> k >> A;
cout << /*(A*(A-2)%mod*pw(A-1,k-2)%mod)*/((pw(-1,n)+mod*mod)%mod*(A-1)%mod+pw(A-1,n))%mod
*pw(pw((pw(A-2,2)+A-1)%mod,n-1),k)%mod << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3404kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 1ms
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 0 0 2 0 0 619159556 44174210 103570820 415637863 304930780 218103365 294935167 29649047 0 0 0 0 0 311752813
result:
wrong answer 2nd lines differ - expected: '6', found: '0'