U E D R , A S I H C RSS

Counting/하기웅

No older revisions available

No older revisions available



~cpp
#include <iostream>
#include "BigInteger.h"
using BigMath::BigInteger;

#define MAX_NUM 1000

int i, j, k, input;
BigInteger number[MAX_NUM+1];

void init(int num)
{
	number[0]=1; 
	number[1]=2; 
	number[2]=5;
	for(i=3; i<num+1; i++)
		number[i]=2*number[i-1]+number[i-2]+number[i-3];
}

int main()
{
	init(1000);
	while(cin>>input)
		cout<< number[input] <<endl;
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0874 sec