Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- cs
- 알고리즘
- 코딩
- 북리뷰
- 오퍼레이팅시스템
- 그래프
- vector
- DP
- 문제풀이
- 정석학술정보관
- coding
- 백준
- 구현
- 컴퓨터공학과
- Operating System
- Stack
- 코테
- 컴공
- 개발
- 자료구조
- c++
- Computer science
- 정석
- 너비우선탐색
- 스택
- 컴공과
- bfs
- OS
- 브루트포스
- 오에스
Archives
- Today
- Total
Little Jay
[C++] 백준 9461번 - 파도반 수열 본문
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n;
long long triangle[101];
void init() {
triangle[1] = 1;
triangle[2] = 1;
triangle[3] = 1;
triangle[4] = 2;
triangle[5] = 2;
for (int i = 6; i <= 100; i++) {
triangle[i] = triangle[i - 1] + triangle[i - 5];
}
return;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
init();
cin >> n;
while (n--) {
int x; cin >> x;
cout << triangle[x] << endl;
}
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++]백준 5014번 - 면접에 늦었다 (0) | 2022.03.14 |
---|---|
[C++] 백준 11055번 - 가장 큰 증가 부분 수열 (0) | 2022.02.21 |
[C++] 백준 1236 - 성지키기 (0) | 2022.02.19 |
[C++] 백준 1076번 - 저항 (0) | 2022.02.18 |
[C++] 백준 6588번 - 골드바흐 추측 (0) | 2022.02.11 |
Comments