CSES - Aalto Competitive Programming 2024 - wk11 - Homework - Results
Submission details
Task:Exponentiation
Sender:Nallue
Submission time:2024-11-18 11:50:57 +0200
Language:C++ (C++11)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.03 sdetails
#2--details
#3--details

Code

#include <iostream>

using namespace std;

typedef long long ll;

#define M 1000000007

ll pow(ll a,ll b){
    if(b==0)return 1;
    ll res=1;
    for(int i=0;i<b;i++)res = (res*a)%M;
    return res;
}

int main(){
    ll n;
    cin >> n;
    for(int i=0;i<n;i++){
        ll a,b;
        cin >> a >> b;
        cout << (pow((a%M),b))%M <<endl;
    }
}

Test details

Test 1

Verdict: ACCEPTED

input
10201
0 0
0 1
0 2
0 3
...

correct output
1
0
0
0
0
...

user output
1
0
0
0
0
...
Truncated

Test 2

Verdict:

input
200000
129612095 411099530
241615980 487174929
60862511 511830781
758816482 982657640
...

correct output
276067146
838400234
148093882
546897305
467086232
...

user output
(empty)

Test 3

Verdict:

input
200000
692427692 536870911
252480658 536870911
505090334 536870911
27194853 536870911
...

correct output
940305728
707431813
917260341
908974199
375947818
...

user output
(empty)