Pagini recente » Cod sursa (job #1213878) | Cod sursa (job #2469438) | Cod sursa (job #2261278) | Cod sursa (job #2447757) | Cod sursa (job #819968)
Cod sursa(job #819968)
#include <fstream>
using namespace std;
long long lgput (long long n, long long p){
long long m=1999999973;
if (p==1) return n;
if (p%2==0){
int res=(lgput(n, p/2));
return (res*res)%m;
}
return (lgput (n, p-1)*n)%m;
}
int main (){
ifstream f("lgput.in");
ofstream g("lgput.out");
long long p, n;
f>>n>>p;
g<<lgput (n, p);
return 0;
}