Pagini recente » Cod sursa (job #307551) | Cod sursa (job #3123989) | Cod sursa (job #421843) | Cod sursa (job #1095587) | Cod sursa (job #889733)
Cod sursa(job #889733)
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
const long long int P=1999999973;
long long int exponentiere(int x,int n){
if(n==1)
return x%P;
else
if(n%2==1)
return ( (x%P)* (exponentiere( (x%P)*(x%P)%P,(n-1)/2)) )%P;
else
return exponentiere ( ((x%P)*(x%P)),n/2);
}
int n,p;
int main(){
f>>p>>n;
g<<exponentiere(p,n);
return 0;
}