diff --git a/H0ngJu/README.md b/H0ngJu/README.md index eea8f055..04be6dd5 100644 --- a/H0ngJu/README.md +++ b/H0ngJu/README.md @@ -1,13 +1,14 @@ ## ✏️ 기록 -| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | -| :---: | :--------: | :------: | :-------------------------------------------------------------------------: | :-------------------------------------------------: | -| 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 | +| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | +| :---: | :--------: | :------: | :-----------------------------------------------------------------------------------: | :-------------------------------------------------: | +| 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 | | 2차시 | 2024.03.07 | 큐 | [다리를 지나는 트럭](https://school.programmers.co.kr/learn/courses/30/lessons/42583) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/153 | -| 3차시 | 2024.03.10 | 힙 | [N번째 큰 수](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 | -| 4차시 | 2024.03.13 | 힙 | [문제집](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 | -| 5차시 | 2024.03.16 | 구현 | [요세푸스 문제](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 | +| 3차시 | 2024.03.10 | 힙 | [N번째 큰 수](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 | +| 4차시 | 2024.03.13 | 힙 | [문제집](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 | +| 5차시 | 2024.03.16 | 구현 | [요세푸스 문제](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 | | 6차시 | 2024.03.19 | 스택 | [오큰수](https://www.acmicpc.net/problem/17298) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/164 | | 7차시 | 2024.03.22 | DP | [1,2,3 더하기](https://www.acmicpc.net/problem/9095) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/166 | +| 8차시 | 2024.03.16 | DP | [쉬운 계단 수](https://www.acmicpc.net/problem/10844) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/170 | --- diff --git "a/H0ngJu/\354\211\254\354\232\264 \352\263\204\353\213\250 \354\210\230.py" "b/H0ngJu/\354\211\254\354\232\264 \352\263\204\353\213\250 \354\210\230.py" new file mode 100644 index 00000000..7c5631a2 --- /dev/null +++ "b/H0ngJu/\354\211\254\354\232\264 \352\263\204\353\213\250 \354\210\230.py" @@ -0,0 +1,28 @@ +import sys + +DIV = 1_000_000_000 + +N = int(sys.stdin.readline().rstrip()) + +dp = [[0] * 10 for _ in range(N+1)] +answer = 0 + +for i in range(1,N+1): + if i == 1: + for k in range(1,10): + dp[i][k] = 1 + + else: + for num in range(10): + if num == 0: + dp[i][num] = dp[i-1][1]%DIV + elif num == 9: + dp[i][num] = dp[i-1][8]%DIV + else: + dp[i][num] = (dp[i-1][num-1] + dp[i-1][num+1])%DIV + +for k in range(10): + answer += dp[N][k] + +print(answer%DIV) +