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