Skip to content

Commit

Permalink
2024-07-03 19:56:04
Browse files Browse the repository at this point in the history
Affected files:
.obsidian/workspace.json
src/content/blog/boj-11057-오르막-수.md
  • Loading branch information
gyunseo committed Jul 3, 2024
1 parent aad4292 commit 6944e1f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"type": "split",
"children": [
{
"id": "8bdc165835cf7e02",
"id": "4687261fa0e002a6",
"type": "tabs",
"children": [
{
"id": "9ffba651efc67257",
"id": "5dda7a5cb081a99f",
"type": "leaf",
"state": {
"type": "markdown",
Expand Down Expand Up @@ -148,10 +148,10 @@
"table-editor-obsidian:Advanced Tables Toolbar": false
}
},
"active": "9ffba651efc67257",
"active": "5dda7a5cb081a99f",
"lastOpenFiles": [
"dist/posts/boj-백준-11507-오르막-수.png",
"src/content/blog/boj-11057-오르막-수.md",
"dist/posts/boj-백준-11507-오르막-수.png",
"src/content/blog/boj-1926-그림.md",
"src/content/blog/boj-11057-.md",
"src/content/blog/leet-code-letter-combinations-of-a-phone-number.md",
Expand Down Expand Up @@ -184,7 +184,6 @@
"dist/tags/ostep/1/index.html",
"dist/tags/ostep/1",
"dist/posts/우테코-2차-소감문.png",
"dist/posts/우테코-1차-소감문.png",
"src/content/blog/boj-11725-트리의-부모-찾기.md",
"src/content/blog/boj-1935-후위-표기식2.md",
"src/content/blog/boj-15666-N과-M-(12).md",
Expand Down
32 changes: 32 additions & 0 deletions src/content/blog/boj-11057-오르막-수.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,35 @@ if __name__ == "__main__":
ret += n % MOD
print(ret % MOD)
```

## 다른 풀이

```python
import sys
from functools import cache

sys.setrecursionlimit(10**6)
input = sys.stdin.readline


@cache
def dfs(n, k):
if n == 1:
return 1
tmp_sum = 0
for i in range(k, 10):
tmp_sum += dfs(n - 1, i) % MOD
tmp_sum %= MOD
return tmp_sum % MOD


if __name__ == "__main__":
MOD = 10_007
N = int(input().strip())
ans = 0
for i in range(10):
ans += dfs(N, i)
ans %= MOD
print(ans % MOD)

```

0 comments on commit 6944e1f

Please sign in to comment.