From 06852f4593863384a98736c41dd0d7260c697796 Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Tue, 1 Jul 2025 23:38:16 +0900 Subject: [PATCH] =?UTF-8?q?[20250701]=20BOJ=20/=20G4=20/=20=EB=9E=A8?= =?UTF-8?q?=ED=94=84=20/=20=EA=B9=80=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../01 BOJ G4 \353\236\250\355\224\204.md" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "suyeun84/202507/01 BOJ G4 \353\236\250\355\224\204.md" diff --git "a/suyeun84/202507/01 BOJ G4 \353\236\250\355\224\204.md" "b/suyeun84/202507/01 BOJ G4 \353\236\250\355\224\204.md" new file mode 100644 index 00000000..66f7e18c --- /dev/null +++ "b/suyeun84/202507/01 BOJ G4 \353\236\250\355\224\204.md" @@ -0,0 +1,37 @@ +```java +import java.io.*; +import java.util.*; + +public class boj1034 { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static StringTokenizer st; + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + + public static void main(String[] args) throws Exception { + nextLine(); + int N = nextInt(); + int M = nextInt(); + int answer = 0; + String[] input = new String[N]; + for (int i = 0; i < N; i++) input[i] = br.readLine(); + HashMap map = new HashMap<>(); + int K = Integer.parseInt(br.readLine()); + for (int i = 0; i < N; i++) { + int count = 0; + for (int j = 0; j < M; j++) { + if (input[i].charAt(j) == '0') { + count++; + } + } + if (count <= K && count % 2 == K % 2) { + map.put(input[i], map.getOrDefault(input[i], 0) + 1); + if (map.get(input[i]) > answer) { + answer = map.get(input[i]); + } + } + } + System.out.println(answer); + } +} +```