Cod sursa(job #1612356)
Utilizator | Data | 24 februarie 2016 20:15:01 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
# include <fstream>
using namespace std;
long long a, b, p;
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
fin>>a>>b;
p=1;
while(b!=0){
if(b%2==1)
p=p*a%1999999973;
a=a*a%1999999973;
b=b/2;
}
fout<<p;
return 0;
}