Cod sursa(job #2383807)
Utilizator | Data | 19 martie 2019 19:57:34 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | excelenta-tema2 | Marime | 0.34 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f ( "lgput.in" ); ofstream g ( "lgput.out" );
int Rp(int b,int p)
{ int r=1;
while(p)
{ if(p&1) r=(1ULL*r*b)% 1999999973 ;
b=(1ULL*b*b)% 1999999973 ;
p>>=1;
}
return r;
}
int main()
{ int a,b;
f>>a>>b;
g<<Rp(a,b);
return 0;
}