[백준]9461 파도반 수열 jyukki included in 백준 2017-11-30 91 words One minute Contents https://www.acmicpc.net/problem/9461 풀이: a[i] 는 i 번째 수열 a[i] = a[i-1] + a[i-5] 코드: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include <iostream> using namespace std; long long a[101] = { 1,1,1,2,2,0 }; int main(void) { int T,n; cin >> T; for (int i = 0; i < T; i++) { cin >> n; for (int t = 5; t < n; t++) { a[t] = a[t - 1] + a[t - 5]; } cout << a[n - 1] << endl; } return 0; } Please enable JavaScript to view the comments powered by Disqus.