VioletaBabel

9461번: 파도반 수열 본문

백준/백준-C++
9461번: 파도반 수열
Beabletoet 2017. 9. 8. 20:59
1
2
3
4
5
6
7
8
9
10
11
#include <cstdio>
int main()
{
    long long int n[100];
    int t, i;
    n[0= n[1= n[2= 1;
    for (int i = 3; i < 100++i)
        n[i] = n[i - 3+ n[i - 2];
    for (scanf("%d"&t); t--printf("%lld\n", n[i - 1]))
        scanf("%d"&i);
}
cs


'백준 > 백준-C++' 카테고리의 다른 글

1149번: RGB거리  (0) 2017.09.13
수학 및 논리 퍼즐  (0) 2017.09.13
10448번: 유레카 이론  (0) 2017.09.08
10158번: 개미  (0) 2017.09.08
10987번: 모음의 개수  (0) 2017.09.07
Comments