[BOJ] 9461번 : 파도반 수열
2024. 9. 2. 16:25ㆍAlgorithm
1. problem :
https://www.acmicpc.net/problem/9461
2. solution 1 :
#include <bits/stdc++.h>
using namespace std;
int t;
long long d[105];
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> t;
d[1] = 1, d[2] = 1, d[3] = 1;
for (int i = 4; i <= 100; i++) d[i] = d[i - 2] + d[i - 3];
while (t--) {
int n;
cin >> n;
cout << d[n] << '\n';
}
}'Algorithm' 카테고리의 다른 글
| [BOJ] 10844번 : 쉬운 계단 수 (0) | 2024.09.03 |
|---|---|
| [BOJ] 14501번 : 퇴사 (0) | 2024.09.02 |
| [BOJ] 11053번 : 가장 긴 증가하는 부분 수열 (1) | 2024.09.02 |
| [BOJ] 11055번 : 가장 큰 증가하는 부분 수열 (0) | 2024.09.02 |
| [BOJ] 1912번 : 연속합 (0) | 2024.09.01 |