Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

피보나치/Leonardong

From ZeroWiki

데블스 캠프 첫째날 피보나치수열 코드


첫번째 코드

#include <iostream> 
using namespace std;
int f(int);

int main()
{
	int input;
	cin >> input;
	cout << f(input);

	return 0;
}

int f(int x)
{
	if ( x==0 )
		return x;
	if ( x==1 ) 
		return x;
	return f(x-1) + f(x-2);
}

데블스캠프2003/첫째날 피보나치