Cod sursa(job #3187148)
Utilizator | Data | 27 decembrie 2023 19:40:58 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include<bits/stdc++.h>
using namespace std;
void boris(){
int mod = 1999999973;
int n, p, j = 1; // 2 4
fin>>n>>p
while(p){ // 4
if(p%2==1){
j=(j*n)%mod;
}
n=(n*n)%mod; // 16
p/=2; // 1
fout<<j;
}
int main(){
ifstream fin("lgput.in");
ofstream fout("lgput.out");
boris();
}