QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102545#5661. Multi-Ladderswakakaka#WA 2ms3392kbC++17704b2023-05-03 14:33:072023-05-03 14:33:11

Judging History

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

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

answer

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define endl '\n'
#define int long long

using namespace std;

const int N = 2e5+10 , M = 1e6+10 , mod = 1e9+7;

int k[N];
int n,m,x;

int ksm(int base,int power) {
    int ans=1;
    while(power) {
        if(power & 1) ans = ans * base % mod;
        power >>= 1;
        base = base * base % mod;
    }
    return ans;
}

void solve(){
    int d;
    cin >> n >> m >> d;
    n = n % mod * m % mod;
    cout << ksm(m,d) % mod * n %mod << endl;
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);
    int T = 1;
    cin >> T ;
    while(T--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3392kb

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

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
81
30
270
9261
22
201078717
895952631
999999440
4802
681274003
841287110
115541007
417269485
22673271
708634746
334588279
49
999999664
39556813

result:

wrong answer 2nd lines differ - expected: '6', found: '81'