Problem

Logic

문제 유형 파악
제약 조건 파악
수도 코드 작성
구현
최적화 및 테스트
개선 가능점

My Code

cpp

boj/10870.cpp
 
#include <vector>
int fibo(int n) {
    if (n <= 2) {
        return 1;
    }
    return fibo(n - 1) + fibo(n - 2);
}
 
int dp(int n) {
    int before = 1;
    int after  = 1;
 
    for (int i = 3; i <= n; ++i) {
        int temp = before;
        before   = after;
        after    = temp + before;
    }
 
    return after;
}
 
void solution() {
    int n;
    cin >> n;
    // dp
    cout << dp(n);
    // recursive
    // cout << fibo(n);
}
 
 

python

boj/10870.py
 
 
 
def solve():
    return