| Task: | Exponentiation |
| Sender: | aalto26kh_033 |
| Submission time: | 2026-11-11 18:21:39 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | details |
| #2 | ACCEPTED | 0.25 s | details |
| #3 | ACCEPTED | 0.29 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (ll i=a;i<=b;i++)
int modpow(int x, int n, int m) {
if (n == 0) return 1%m;
long long u = modpow(x,n/2,m);
u = (u*u)%m;
if (n%2 == 1) u = (u*x)%m;
return u;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
for (int i=0;i<n;i++){
int a, b;
cin >> a >> b;
cout << modpow(a, b, (int) pow(10,9)+7) << '\n';
}
return 0;
}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 ... |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 200000 129612095 411099530 241615980 487174929 60862511 511830781 758816482 982657640 ... |
| correct output |
|---|
| 276067146 838400234 148093882 546897305 467086232 ... |
| user output |
|---|
| 276067146 838400234 148093882 546897305 467086232 ... |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 200000 692427692 536870911 252480658 536870911 505090334 536870911 27194853 536870911 ... |
| correct output |
|---|
| 940305728 707431813 917260341 908974199 375947818 ... |
| user output |
|---|
| 940305728 707431813 917260341 908974199 375947818 ... |
