Cod sursa(job #2084843)
Utilizator | Data | 9 decembrie 2017 12:16:45 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long a,b,p=1;
int main()
{
f>>a>>b;
while(b)
{
if(b&1)
p=(p%1999999973 * a%1999999973)%1999999973;
a*=a%1999999973;
b>>=1;
}
g<<p % 1999999973;
}