QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#520949#5661. Multi-Laddersouo#WA 0ms3736kbC++201.0kb2024-08-15 18:02:022024-08-15 18:02:03

Judging History

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

  • [2024-08-15 18:02:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3736kb
  • [2024-08-15 18:02:02]
  • 提交

answer

#include <bits/stdc++.h>

#ifdef LOCAL
using std::cerr;

#else

#endif

#define F first
#define S second
#define pb push_back
#define ALL(x) begin(x), end(x)

using namespace std;
using pii = pair<int, int>;
using ll = long long;
const ll P = 1e9 + 7;

ll fpow(ll a, ll ti) {
    if (ti < 1) return 1;
    int tmp = fpow(a, ti>>1);
    tmp *= tmp;
    tmp %= P;
    if (ti & 1) return tmp * a % P;
    return tmp;
}

ll n, k, c;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int tc = 1;
    cin >> tc;
    while (tc--) {
        cin >> n >> k >> c;
        if (c == 0) {
            cout << 0 << '\n';
            continue;
        }
        ll a3 = c * (c - 1) * (c - 2);
        ll an = c * fpow(c-1, k-1) % P;
        an -= a3;
        an = ((an % P) + P) % P;

        ll t = (c - 2) * 2 + 1;
        t %= P;
        t += (c - 2) * (c - 3);
        t %= P;
        t = fpow(t, n - 1);
        t = fpow(t, k);
        ll ans = an * t % P;
        cout << ans << '\n';
    }
    return 0;
}

详细

Test #1:

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

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

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
2
2
0
656030811
366345909
728924878
58281652
206896652
907726535
644227606
582178378
950956404
694038424
203803962
0
0
510931075

result:

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