Pagini recente » Cod sursa (job #3288572) | Cod sursa (job #2539569) | Diferente pentru problema/convertor intre reviziile 32 si 24 | Cod sursa (job #3295516) | Cod sursa (job #189003)
Cod sursa(job #189003)
#include<fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long pow(long x, long n);
int main()
{
int m,n;
fin>>m>>n;
fout<<pow(m,n);
return 0;
}
long pow(long x, long n)
{
long result = 1;
while ( n ) {
if ( n & 1 ) {
result = result * x;
n = n-1;
}
x = x*x;
n = n/2;
}
return result;
}