baekjoon 20260106
This commit is contained in:
parent
3eeaae2024
commit
6ee6a07bcc
23
code_study/Baekjoon/python/11049.py
Normal file
23
code_study/Baekjoon/python/11049.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
N = int(input())
|
||||||
|
matrix_size = [[0,0]] + [list(map(int, input().split())) for _ in range(N)]
|
||||||
|
|
||||||
|
INF = float("inf")
|
||||||
|
dp = [[INF]*(N+1) for _ in range(N+1)]
|
||||||
|
for i in range(1,N+1) :
|
||||||
|
dp[i][i] = 0
|
||||||
|
|
||||||
|
for l in range(2,N+1) :
|
||||||
|
for left in range(1,N) :
|
||||||
|
right = left + l - 1
|
||||||
|
if right > N :
|
||||||
|
continue
|
||||||
|
|
||||||
|
if l == 2 :
|
||||||
|
dp[left][right] = matrix_size[left][0]*matrix_size[left][1]*matrix_size[right][1]
|
||||||
|
|
||||||
|
else :
|
||||||
|
for k in range(left+1, right) :
|
||||||
|
temp = dp[left][k] + dp[k+1][right] + matrix_size[left][0]*matrix_size[k][1]*matrix_size[right][1]
|
||||||
|
dp[left][right] = min(dp[left][right], temp)
|
||||||
|
|
||||||
|
print(dp[1][N])
|
||||||
1
code_study/Baekjoon/python/14928.py
Normal file
1
code_study/Baekjoon/python/14928.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
print(int(input())%20000303)
|
||||||
Loading…
x
Reference in New Issue
Block a user