Cod sursa(job #2863308)
| Utilizator | Data | 6 martie 2022 16:08:57 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <bits/stdc++.h>
#define uint unsigned int
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
const int MOD = 1999999973;
uint lgput(uint a, uint b){
uint answer = 1;
while(b != 0){
if(b&1)
answer = (long long)answer * a % MOD;
a = (long long)a * a % MOD;
b >>= 1;
}
return answer;
}
signed main (){
ios_base::sync_with_stdio(false);
fin.tie(nullptr);
fout.tie(nullptr);
uint a, b;
fin>>a>>b;
fout<<lgput(a, b);
return 0;
}
