Cod sursa(job #2718522)
Utilizator | Data | 8 martie 2021 19:44:41 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.3 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;
b=b*b;
e=e/2;
}
fe<<P%1999999973;
return 0;
}