Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

58-xxubin04 #219

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions xxubin04/DP/9095_1,2,3 λ”ν•˜κΈ°.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
input = open(0).readline

def dp(value):
if value == 1:
return(1)
elif value == 2:
return(2)
elif value == 3:
return(4)
else:
return dp(value-3)+dp(value-2)+dp(value-1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사싀 μ΄λ ‡κ²Œ μž¬κ·€ν•¨μˆ˜ κ²°κ³Όλ₯Ό μ¦‰μ‹œ λ¦¬ν„΄ν•˜λŠ” 것은 μ—„λ°€νžˆ 따지면 "λ‹€μ΄λ‚˜λ―Ή ν”„λ‘œκ·Έλž˜λ°" 기법은 μ μš©λ˜μ§€ μ•Šμ€ κ±°κΈ΄ ν•©λ‹ˆλ‹€. μ€‘λ³΅λ˜λŠ” μ—°μ‚° κ²°κ³Όλ₯Ό 미리 캐싱해놓고, λ‚˜μ€‘μ— 이λ₯Ό λ‹€μ‹œ ν™œμš©ν•΄μ•Ό ν•˜λŠ”λ° μ—¬κΈ°μ„œλŠ” μ¦‰μ‹œ 값을 returnν•˜κΈ° λ•Œλ¬Έμ— 쀑볡 연산을 맀번 λ°˜λ³΅ν•˜κ²Œ λ˜λ‹ˆκΉŒμš” :)


for i in range(n := int(input())):
print(dp(int(input())))
4 changes: 3 additions & 1 deletion xxubin04/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@
| 52μ°¨μ‹œ | 2024.07.05 | κ΅¬ν˜„ | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/64065">[2019 카카였 인턴십]νŠœν”Œ </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/198 |
| 53μ°¨μ‹œ | 2024.07.08 | DP | <a href="https://www.acmicpc.net/problem/2193">[2193]이친수 </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/200 |
| 54μ°¨μ‹œ | 2024.07.11 | Tree | <a href="https://www.acmicpc.net/problem/1991">[1991]트리 순회 </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/203 |
| 55μ°¨μ‹œ | 2024.07.29 | μ •λ ¬ | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/42747?language=python3">[Programmers]H-Index </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/208 |
| 55μ°¨μ‹œ | 2024.07.29 | μ •λ ¬ | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/42747?language=python3">[Programmers]H-Index </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/208 |
| 55μ°¨μ‹œ | 2024.07.29 | μ •λ ¬ | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/42747?language=python3">[Programmers]H-Index </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/208 |
| 58μ°¨μ‹œ | 2024.09.04 | DP | <a href="hthttps://www.acmicpc.net/problem/9095">[9095]1,2,3 λ”ν•˜κΈ° </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/219 |
Loading