U E D R , A S I H C RSS

The Priest Mathematician/하기웅

~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;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:13
Processing time 0.0292 sec