본문 바로가기
알고리즘/DP

1309 동물원

by tryotto 2019. 7. 8.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
 
int arr[100005= { 0 };
 
int main() {
    int n;
    scanf("%d"&n);
 
    arr[1= 3;
    arr[2= 7;
    for (int i = 3; i <= n; i++) {
        arr[i] = (arr[i - 1* 2 + arr[i - 2]) % 9901;
    }
 
    printf("%d", arr[n]);
}
cs


'알고리즘 > DP' 카테고리의 다른 글

1965 상자넣기  (0) 2019.07.08
11054 가장 긴 바이토닉 부분수열  (0) 2019.07.08
1904 01타일  (0) 2019.07.08
2133 타일 채우기  (0) 2019.07.08
14501 퇴사  (0) 2019.07.07