Cod sursa(job #2699044)
Utilizator | Data | 23 ianuarie 2021 16:09:09 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include <fstream>
using namespace std;
ifstream fin("Igpot.in");
ofstream fout("Igput.out");
int a,p,n;
int main()
{
fin>>a>>n;
while(n)
{
if(n%2==1)
{
p=(p*a)%1999999973;
}
a*=a;
n/=2;
}
fout<<p;
return 0;
}