Cod sursa(job #3260145)
Utilizator | Data | 30 noiembrie 2024 12:24:22 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <fstream>
#define mod 1999999973
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int x,y;
int powlog(int a,int b){
int p=1;
while(b!=0){
if(b%2==1)
p=p*a%mod;
a=a*a%mod;
b=b/2;
}
return p;
}
int main()
{
fin>>x>>y;
fout<<powlog(x,y);
return 0;
}