From 7aa9d33e036193026078490a9d75aecb5613f005 Mon Sep 17 00:00:00 2001 From: JHLEE325 <82587652+JHLEE325@users.noreply.github.com> Date: Fri, 28 Nov 2025 09:47:21 +0900 Subject: [PATCH] =?UTF-8?q?[20251127]=20BOJ=20/=20G5=20/=20=EC=84=A0?= =?UTF-8?q?=EB=B0=9C=20=EB=AA=85=EB=8B=A8=20/=20=EC=9D=B4=EC=A4=80?= =?UTF-8?q?=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\353\260\234 \353\252\205\353\213\250.md" | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 "JHLEE325/202511/27 BOJ G5 \354\204\240\353\260\234 \353\252\205\353\213\250.md" diff --git "a/JHLEE325/202511/27 BOJ G5 \354\204\240\353\260\234 \353\252\205\353\213\250.md" "b/JHLEE325/202511/27 BOJ G5 \354\204\240\353\260\234 \353\252\205\353\213\250.md" new file mode 100644 index 00000000..d401f75b --- /dev/null +++ "b/JHLEE325/202511/27 BOJ G5 \354\204\240\353\260\234 \353\252\205\353\213\250.md" @@ -0,0 +1,45 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + static int[][] player = new int[11][11]; + static boolean[] visited = new boolean[11]; + static int res; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st; + + int T = Integer.parseInt(br.readLine()); + + for (int t = 0; t < T; t++) { + for (int i = 0; i < 11; i++) { + st = new StringTokenizer(br.readLine()); + for (int j = 0; j < 11; j++) { + player[i][j] = Integer.parseInt(st.nextToken()); + } + } + + res = 0; + dfs(0, 0); + System.out.println(res); + } + } + + static void dfs(int pos, int temp) { + if (pos == 11) { + res = Math.max(res, temp); + return; + } + + for (int i = 0; i < 11; i++) { + if (!visited[i] && player[i][pos] > 0) { + visited[i] = true; + dfs(pos + 1, temp + player[i][pos]); + visited[i] = false; + } + } + } +} +```