Pagini recente » Cod sursa (job #967069) | Cod sursa (job #1042908) | Monitorul de evaluare | Monitorul de evaluare | Cod sursa (job #392747)
Cod sursa(job #392747)
#include<fstream>
using namespace std;
int power(int x,int n)
{
if(n == 0)return 1;
else if(n%2 != 0) return x*(power(x,(n-1)/2)*power(x,(n-1)/2));
else return (power(x,n/2)*power(x,n/2));
}
const unsigned long a = 1999999973;
int main()
{
ifstream fin("kfib.in");
ofstream fout("kfib.out");
unsigned long x,n;
fin>>x>>n;
fout<<power(x,n);
fin.close();
fout.close();
return 0;
}