Cod sursa(job #3210963)
Utilizator | Data | 7 martie 2024 19:59:29 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main(){
long long n, p,np=2;
fin >> n >> p;
while(p>0){
if(p%2==0){
p = p / 2;
}
else{
p--;
}
np = np * n;
np = np % 1999999973;
}
fout << np;
}