No older revisions available
No older revisions available
~cpp
#include <iostream>
#include <limits.h>
#include "BigInteger.h"
using BigMath::BigInteger;
#define MAX_DISK 10000
BigInteger fourPin[MAX_DISK+1];
int i, k, number, counting, exponent;
BigInteger bi = 2;
void hanoiInit()
{
counting = 1;
exponent = 0;
while(counting<=MAX_DISK)
{
for(k=counting; k<=counting+exponent && k<=MAX_DISK; k++)
fourPin[k] = fourPin[k-1] + bi.Power(exponent);
counting = k;
exponent++;
}
}
int main()
{
hanoiInit();
while(cin>>number)
cout<<fourPin[number]<<endl;
return 0;
}