Skip to content

Commit

Permalink
2024-05-13 00:38:03
Browse files Browse the repository at this point in the history
Affected files:
.obsidian/workspace.json
src/content/blog/boj-11507-오르막-수.md
  • Loading branch information
gyunseo committed May 12, 2024
1 parent 77c9b64 commit 4d80758
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 8 deletions.
29 changes: 21 additions & 8 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,21 @@
"source": false
}
}
},
{
"id": "7b3dd1b0a75c5d97",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "src/content/blog/boj-11507-오르막-수.md",
"mode": "source",
"source": false
}
}
}
]
],
"currentTab": 1
}
],
"direction": "vertical"
Expand Down Expand Up @@ -103,7 +116,7 @@
"state": {
"type": "backlink",
"state": {
"file": "src/content/blog/boj-1912-연속합.md",
"file": "src/content/blog/boj-11507-오르막-수.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
Expand All @@ -120,7 +133,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "src/content/blog/boj-1912-연속합.md",
"file": "src/content/blog/boj-11507-오르막-수.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
Expand All @@ -143,7 +156,7 @@
"state": {
"type": "outline",
"state": {
"file": "src/content/blog/boj-1912-연속합.md"
"file": "src/content/blog/boj-11507-오르막-수.md"
}
}
}
Expand All @@ -166,10 +179,11 @@
"table-editor-obsidian:Advanced Tables Toolbar": false
}
},
"active": "fbca317c99f1a7a9",
"active": "7b3dd1b0a75c5d97",
"lastOpenFiles": [
"src/content/blog/boj-1699-제곱수의-합.md",
"src/content/blog/boj-1912-연속합.md",
"src/content/blog/boj-11507-오르막-수.md",
"src/content/blog/boj-1699-제곱수의-합.md",
"src/content/blog/boj-15666-N과-M-(12).md",
"src/content/blog/boj-1940-주몽.md",
"src/content/blog/boj-11725-트리의-부모-찾기.md",
Expand Down Expand Up @@ -212,7 +226,6 @@
"src/content/blog/24-sw-maestro-1st-coding-test.md",
"src/content/blog/programmers-인기있는-아이스크림.md",
"src/content/blog/programmers-가장-비싼-상품-구하기.md",
"src/assets/template/obsidian-template.md",
"src/content/blog/ubuntu-partition.md"
"src/assets/template/obsidian-template.md"
]
}
55 changes: 55 additions & 0 deletions src/content/blog/boj-11507-오르막-수.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
author: Gyunseo Lee
title: "BOJ 백준 11507: 오르막 수"
pubDatetime: 2024-05-13T00:35:00+09:00
modDatetime: 2024-05-13T00:35:00+09:00
featured: false
draft: false
tags:
- PS
- Algorithms
- BOJ
- DP
- 실랜디
description: "백준 11507: 오르막 수 풀이 과정"
ogImage: ""
---

## Table of contents

## 들어가며

이 문제는 완탐으로 풀려고 하면요.
무려 $10^{1000}$ 이라는 미친 가짓수가 나와서, 완탐으로는 못 풀어서 딴 풀이를 생각해야 합니다.
그래서 저는 DP를 의심했습니다.
왜냐면, 일일히 가짓수를 세보는데 전에 세었던 가짓수가 필요하더라고요.

## 풀이 과정

![](https://res.cloudinary.com/gyunseo-blog/image/upload/f_auto/v1715528268/image_rpxozq.png)

## AC 받은 Python 코드

```python
import sys

input = sys.stdin.readline
MOD = 10_007
if __name__ == "__main__":
N = int(input().rstrip())
dp = [[0 for _ in range(10)] for __ in range(N + 1)]
for i in range(10):
dp[1][i] = 1
for i in range(2, N + 1):
for j in range(10):
tmp_sum = 0
for k in range(j, 10):
tmp_sum += dp[i - 1][k]
dp[i][j] = tmp_sum % MOD
ans = 0
for i in range(10):
# print(f"dp[{N}][{i}]: {dp[N][i]}")
ans += dp[N][i] % MOD
print(ans % MOD)

```

0 comments on commit 4d80758

Please sign in to comment.