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 2021-02-07 05:23:01
Processing time 0.0154 sec