Cod sursa(job #2911594)
Utilizator | Data | 30 iunie 2022 17:12:05 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.21 kb |
#include<fstream>
using namespace std;
long long y=1,x,N=2e9-27,p;
int main()
{
for(ifstream("lgput.in")>>x>>p;p;p>>=1,x=x*x%N)
if(p&1)
y=x*y%N;
return ofstream("lgput.out")<<y,0;
}