~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;
}
Retrieved from http://wiki.zeropage.org/wiki.php/Counting/하기웅
last modified 2021-02-07 05:23:01