QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#578159#5661. Multi-LaddersCelestialCoder#WA 0ms3700kbC++20838b2024-09-20 17:04:012024-09-20 17:04:02

Judging History

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

  • [2024-09-20 17:04:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-09-20 17:04:01]
  • 提交

answer

#include <bits/stdc++.h>
#ifdef SHARAELONG
#include "../../cpp-header/debug.hpp"
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

ll power(ll a, ll pow) {
    ll ret = 1;
    while (pow > 0) {
        if (pow & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        pow /= 2;
    }
    return ret;
}

void solve() {
    ll n, k, c;
    cin >> n >> k >> c;
    if (c == 0 || c == 1) {
        cout << "0\n";
        return;
    }
    
    ll ans = power(c-1, n) + power(c-1, 1) * (n % 2 == 1 ? -1 : 1);
    ans = ans * power((c*c-c*3+3) % MOD, (n-1)*k) % MOD;
    cout << (ans + MOD) % MOD << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int cases;
    cin >> cases;
    while (cases--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

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'