Pagini recente » Cod sursa (job #3030475) | Cod sursa (job #534707) | Cod sursa (job #1076374) | Cod sursa (job #2523312) | Cod sursa (job #1254803)
#include <fstream>
using namespace std;
ifstream is("lgput.in");
ofstream os("lgput.out");
#define Mod 1999999973
int x, n;
long long p;
int s;
void Power(int n, int x);
int main()
{
is >> x >> n;
p = 2;
Power(n, x);
os << p;
is.close();
os.close();
return 0;
}
void Power(int n, int x)
{
if(n == 0)
{
p = 1;
return;
}
if(n == 1)
{
return;
}
if(n % 2 == 0)
{
Power(n/2, x);
p *= p ;
p %= Mod;
}
if(n % 2 == 1)
{
Power((n-1), x);
p *= x;
p %= Mod;
}
}