QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#85125 | #5661. Multi-Ladders | piasticOuO# | WA | 4ms | 3556kb | C++14 | 748b | 2023-03-06 23:44:03 | 2023-03-06 23:44:07 |
Judging History
answer
#include <iostream>
using namespace std;
const long long modf = 1e9 + 7;
long long T, n, k, u;
long long fjz[3][3], xl[3];
long long qc(long long x, long long y) {
long long uu = 1;
while (y) {
if (y & 1)
uu = uu * x % modf;
x = x * x % modf;
y >>= 1;
}
return uu;
}
void solve() {
cin >> n >> k >> u;
//\xd6\xdcΧ
long long d = ((u - 2) * (u - 2) % modf + u - 1) % modf;
long long v = k * (n - 1) % modf;
long long dy = qc(d, v);
//\xbb\xb7
long long c = qc(u - 1, k);
if (k % 2) {
c = c - u + 1;
if (c < 0)
c += modf;
}
long long ans = c * dy % modf;
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> T;
while (T--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 4ms
memory: 3368kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3556kb
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 1 200457106 286081898 5832209 581811561 176686901 329042905 871718411 462822417 693053420 783715673 980402577 666021604 0 37083947
result:
wrong answer 6th lines differ - expected: '0', found: '1'