#include <iostream>
using namespace std;
int d[1001];
void cal(int n) {
d[0] = 1;
d[1] = 1;
for (int i = 2; i <= n; i++) {
d[i] = d[i - 1] + d[i - 2];
d[i] %= 10007;
}
}
auto main()->int {
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int n; cin >> n;
cal(n);
cout << d[n] << endl;
}
'Problem set' 카테고리의 다른 글
[백준] 16194: 카드 구매하기 2 (0) | 2020.12.29 |
---|---|
[백준] 11727: 2×n 타일링 2 (0) | 2020.12.29 |
[백준] 11052: 카드 구매하기 (0) | 2020.12.29 |
[백준] 10872: 팩토리얼 (0) | 2020.12.29 |
[백준] 10870: 피보나치 수 5 (0) | 2020.12.29 |