Cod sursa(job #1711687)
Utilizator | Data | 31 mai 2016 22:32:02 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <bits/stdc++.h>
#define modulo 1999999973
using namespace std;
int put(int a,int b)
{
int r=1;
while(b)
{
if(b%2==1)
r= 1LL*r*a%modulo;
a=1LL*a*a%modulo;
b=b/2;
}
return r;
}
int main()
{
ifstream f("lgput.in");
ofstream g("lgput.out");
int x,y;
f>>x>>y;
g<<put(x,y);
f.close();
return 0;
}