Cod sursa(job #694719)
Utilizator | Data | 27 februarie 2012 23:01:46 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include <fstream>
using namespace std;
int mod=1999999973;
long long x,y,r=1;
int main ()
{ifstream f("lgput.in");
ofstream g("lgput.out");
f>>x>>y;
while(y)
{if(y%2)
r=(x*r)%mod;
x=(x*x)%mod;
y/=2;}
g<<r;
f.close(); g.close();
return 0;
}