QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135421#5661. Multi-LaddersNicolas125841WA 1ms3592kbC++17881b2023-08-05 15:06:142023-08-05 15:06:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-05 15:06:15]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3592kb
  • [2023-08-05 15:06:14]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const ll mod = 1000000007;

ll modpow(ll b, ll e) {
    ll ans = 1;
    for (; e; b = b * b % mod, e /= 2)
        if (e & 1) ans = ans * b % mod;
    return ans;
}

int main(){
    cin.tie(NULL)->sync_with_stdio(false);

    int t;
    cin >> t;

    while(t--){
        ll n, k, l;
        cin >> n >> k >> l;

        ll spurs = modpow(modpow(((l - 1) + modpow(l - 2, 2)) % mod, k), n-1);
        ll ring =  l * modpow(l - 1, k - 1) % mod - l * modpow(l - 1, k - 2) % mod;
        
        ring %= mod;

        if(ring < 0)
            ring += mod;

        cout << ring * spurs % mod  << "\n";
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3592kb

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3464kb

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
0
388318872
891305474
52489881
186358669
176686901
502286001
558243892
873610512
67213250
423049
869536635
0
0
145046875

result:

wrong answer 7th lines differ - expected: '349400141', found: '388318872'