Skip to content

Commit

Permalink
2024.03.27 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
JangHongJoon committed Mar 27, 2024
1 parent 18146fb commit ccd1946
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions wkdghdwns199/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
| 13μ°¨μ‹œ | 2024.03.09 | DP | <a href="https://www.acmicpc.net/problem/1932">μ •μˆ˜ μ‚Όκ°ν˜•</a> | <a href="">2024.03.09</a> |
| 14μ°¨μ‹œ | 2024.03.13 | 집합과 맡 | <a href="https://www.acmicpc.net/problem/20920">μ˜λ‹¨μ–΄ μ•”κΈ°λŠ” κ΄΄λ‘œμ›Œ</a> | <a href="">2024.03.13</a> |
| 15μ°¨μ‹œ | 2024.03.20 | μš°μ„ μˆœμœ„ 큐 | <a href="https://www.acmicpc.net/problem/11286">μ ˆλŒ“κ°’ νž™</a> | <a href="">2024.03.20</a> |
| 17μ°¨μ‹œ | 2024.03.27 | DP | <a href="https://www.acmicpc.net/problem/9184">μ‹ λ‚˜λŠ” ν•¨μˆ˜ μ‹€ν–‰</a> | <a href="">2024.03.27</a> |

25 changes: 25 additions & 0 deletions wkdghdwns199/동적_κ³„νšλ²•_1/ACM-24416.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
input = sys.stdin.readline

def fib(n) :
global countFib
if n==1 or n==2:
countFib += 1
return 1
else :
return fib(n-1) + fib(n-2)

def fibo(n):
global countFibo
f = [0 for _ in range(n+1)]
f[1] = f[2] = 1
for idx in range(3, n+1):
countFibo+=1
f[idx] = f[idx-1] + f[idx-2]
return f[n]

N = int(input())
countFib = countFibo = 0
fib(N)
fibo(N)
print(countFib, countFibo)
25 changes: 25 additions & 0 deletions wkdghdwns199/동적_κ³„νšλ²•_1/ACM-9184.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
input = sys.stdin.readline

def w(a,b,c):
if a<=0 or b<=0 or c<=0 :
return 1
if a>20 or b>20 or c>20:
return w(20,20,20)
if dp[a][b][c] :
return dp[a][b][c]
if a<b<c:
dp[a][b][c] = w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c)
return dp[a][b][c]
dp[a][b][c] = w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1)
return dp[a][b][c]


dp = [[[0] * 21 for _ in range(21)] for _ in range(21)]

while True:
a,b,c = map(int, input().split())
if a==b==c==-1 : break
print(f'w({a}, {b}, {c}) = {w(a,b,c)}')


0 comments on commit ccd1946

Please sign in to comment.