9461번: 파도반 수열

myeongrangcoding·2023년 12월 26일
0

백준

목록 보기
39/47

https://www.acmicpc.net/problem/9461

풀이

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	//freopen("input.txt", "rt", stdin);

	long long DynamicLengths[101] = { 0, 1, 1, 1, 2, 2, 3, 4, 5, 7, };

	for (int i{ 10 }; i <= 100; ++i)
	{
		DynamicLengths[i] = DynamicLengths[i - 1] + DynamicLengths[i - 5];
	}

	int CntCase{};
	cin >> CntCase;

	for (int i{}; i < CntCase; ++i)
	{
		int N{};
		cin >> N;
		cout << DynamicLengths[N] << '\n';
	}

	return 0;
}
profile
명랑코딩!

0개의 댓글