Cod sursa(job #1189758)
Utilizator | Data | 23 mai 2014 14:04:01 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long p,x;
int n;
int main()
{f>>x>>n;
p=1;
while(n>0){
if(n%2!=0)
p=p*x;
x=x*x;
n=n/2;}
g<<p%1999999973;
return 0;
}