Cod sursa(job #3187150)
Utilizator | Data | 27 decembrie 2023 19:43:32 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include<bits/stdc++.h>
using namespace std;
void boris(){
int mod = 1999999973;
int n, p, j = 1; // 2 4
ifstream fin("lgput.in");
ofstream fout("lgput.out");
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(){
boris();
}