Pagini recente » Cod sursa (job #2656486) | Cod sursa (job #330922) | Cod sursa (job #423794) | Cod sursa (job #1216750) | Cod sursa (job #588653)
Cod sursa(job #588653)
#include<fstream>
#define c 1999999973;
using namespace std;
int hatvany(int n,int p){
if(p==0)
return 1;
else
if(p%2==0){
int h=hatvany(n,p/2);
return (h*h)%c;
}
else{
int h=hatvany(n,p/2);
return (h*h*n)%c;
}
}
int main(){
fstream f,g;
f.open("lgput.in",ios::in);
g.open("lgput.out",ios::out);
int n,p;
f>>n>>p;
g<<hatvany(n,p);
f.close();
g.close();
}