백준 문제풀이 (C++)/재귀함수
[재귀함수] 10870번 피보나치 수 5 풀이 c++
haula
2020. 8. 15. 13:45
백준 10870번 피보나치수5 문제풀이
https://www.acmicpc.net/problem/10870
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include<iostream> using namespace std; int fivo(int N) { if (N == 0) return 0; if (N == 1) return 1; return fivo(N-1)+ fivo(N-2); } int main() { int N; cin >> N; cout << fivo(N); } | cs |