Cod sursa(job #3123715)
Utilizator | Data | 25 aprilie 2023 09:40:18 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <fstream>
#define c 1999999973
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.in");
long long a,b;
int put(long long a,long long b)
{
long long x=1;
while(b!=0)
{
if(b%2==1)
{
x=x*a%c;
}
b=b/2;
a=a*a%c;
}
return x;
}
int main()
{
fin>>a>>b;
fout<<put(a,b);
return 0;
}