Cod sursa(job #2718529)
Utilizator | Data | 8 martie 2021 19:45:46 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream fe("lgput.out");
int main()
{
unsigned long long b,e,P=1;
f>>b;
f>>e;
while(e)
{
if(e % 2 == 1)
P=(P*b)%1999999973;
b=(b*b)%1999999973;
e=e/2;
}
fe<<P%1999999973;
return 0;
}