Pagini recente » Cod sursa (job #3312239) | Cod sursa (job #1065459) | Cod sursa (job #23340) | Cod sursa (job #1702395) | Cod sursa (job #3345162)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
long long a, b, c;
long long mod = 1999999973;
long long factorial(long long b, long long a)
{
long long aux, rez;
if(a == 0)
return 1;
else if(a % 2 == 0)
{
aux = factorial(b, a / 2);
rez = aux * aux;
rez = rez % mod;
return rez;
}
else if(a % 2 == 1)
{
aux = factorial(b, a - 1) * b;
aux = aux % mod;
return aux;
}
}
int main()
{
fin >> a >> b;
fout << factorial(a,b);
return 0;
}