Pagini recente » Cod sursa (job #570143) | Istoria paginii utilizator/gruhten | Cod sursa (job #1863040) | Rating UPB-Farcasanu-Iancu-Poenaru (gobanana) | Cod sursa (job #1526031)
#include <iostream>
#include <fstream>
using namespace std;
const int oo = 1999999973 ;
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
int n,m ;
scanf("%d %d",&n ,&m);
unsigned long long x = n ,y = 1;
if (n == 0) printf("1");
while (m > 1) {
if (m%2 == 0) {
x = (x*x) % oo ;
m = m / 2;
}
else {
y = (y*x)%oo;
x = (x*x)%oo;
m = (m-1)/2;
}
}
int result = (x*y) % oo ;
printf("%d" , result);
fclose(stdin);
fclose(stdout);
return 0;
}