diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index b3e4c8348..e8b54bb8f 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -4,11 +4,11 @@ "type": "split", "children": [ { - "id": "8bdc165835cf7e02", + "id": "4687261fa0e002a6", "type": "tabs", "children": [ { - "id": "9ffba651efc67257", + "id": "5dda7a5cb081a99f", "type": "leaf", "state": { "type": "markdown", @@ -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", @@ -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", diff --git "a/src/content/blog/boj-11057-\354\230\244\353\245\264\353\247\211-\354\210\230.md" "b/src/content/blog/boj-11057-\354\230\244\353\245\264\353\247\211-\354\210\230.md" index 3c7d6a910..0c1fd8185 100644 --- "a/src/content/blog/boj-11057-\354\230\244\353\245\264\353\247\211-\354\210\230.md" +++ "b/src/content/blog/boj-11057-\354\230\244\353\245\264\353\247\211-\354\210\230.md" @@ -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) + +```