Notice
Recent Posts
Recent Comments
Link
Little Jay
[C++] 백준 2747번 피보나치 수 본문
간단한 피보나치 문제
재귀를 아마 못쓰는 문제인 것 같다
#include <iostream>
using namespace std;
int main() {
int first = 0;
int second = 1;
int input;
cin >> input;
for (int i = 1; i < input; i++) {
int third = first + second;
first = second;
second = third;
}
cout << second << "\n";
}
'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 2908번 상수 (0) | 2021.03.01 |
|---|---|
| [C++] 백준 1267번 핸드폰 요금 (0) | 2021.02.28 |
| [C++] 백준 2693번 N번째 큰 수 (0) | 2021.02.28 |
| [C++] 백준 3507번 Automated Telephone Exchange (0) | 2021.02.27 |
| [C++] 백준 18108번 1998년생인 내가 태국에서는 2541년생?! (0) | 2021.02.27 |
Comments