From 44e626c5c82b90a364c6c4a5ae49bddc71621dfe Mon Sep 17 00:00:00 2001 From: wwan13 Date: Sun, 28 Apr 2024 22:08:17 +0900 Subject: [PATCH] =?UTF-8?q?solve=20:=2011048=20=EC=9D=B4=EB=8F=99=ED=95=98?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/boj_11048.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 python/boj_11048.py diff --git a/python/boj_11048.py b/python/boj_11048.py new file mode 100644 index 0000000..1955de7 --- /dev/null +++ b/python/boj_11048.py @@ -0,0 +1,27 @@ +import sys + +input = sys.stdin.readline + + +def solution(n, m, data): + dp = [[0 for _ in range(m+1)] for _ in range(n+1)] + + for i in range(1, n+1): + for j in range(1, m+1): + dp[i][j] = max(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + data[i-1][j-1] + + return dp[-1][-1] + + +def display_result(answer): + print(answer) + + +def main(): + n, m = map(int, input().split()) + data = [list(map(int, input().split())) for _ in range(n)] + answer = solution(n, m, data) + display_result(answer) + + +main() \ No newline at end of file