Cod sursa(job #2568927)
Utilizator | Data | 4 martie 2020 10:29:03 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int F(int a,int b)
{
int p=1;
while(b>0)
{
if(b%2==1)
p=1LL*a*p%1999999973;
a=1LL*a*a%1999999973;
b/=2;
}
return p;
}
int main()
{
int a,b;
fin>>a>>b;
fout<<F(a,b);
return 0;
}