From 4854662a5e9a18ec98b705a47388ef9447e47739 Mon Sep 17 00:00:00 2001 From: longrunpc Date: Thu, 9 Apr 2026 17:31:34 +0900 Subject: [PATCH] =?UTF-8?q?Solve(dp):=20BOJ=2015486=20"=ED=87=B4=EC=82=AC?= =?UTF-8?q?=202"=20=EB=AC=B8=EC=A0=9C=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- boj/solved/dp/15486/Main.java | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 boj/solved/dp/15486/Main.java diff --git a/boj/solved/dp/15486/Main.java b/boj/solved/dp/15486/Main.java new file mode 100644 index 0000000..3db7cc2 --- /dev/null +++ b/boj/solved/dp/15486/Main.java @@ -0,0 +1,42 @@ +import java.io.*; +import java.util.*; + +class Main { + static int n; + static int[][] arr; + static int[] dp; + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + n = Integer.parseInt(br.readLine()); + + arr = new int[n][2]; + dp = new int[n+1]; + + for(int i = 0;i n) { + continue; + } + dp[i+t] = Math.max(dp[i+t], dp[i] + p); + } + + int res = 0; + for(int i = 0;i<=n;i++) { + res = Math.max(res, dp[i]); + } + + System.out.println(res); + } +}