Skip to content

Commit 4c9d8d4

Browse files
authored
Merge pull request #405 from AlgorithmWithGod/suyeun84
[20250701] BOJ / G4 / 램프 / 김수연
2 parents 805796a + 06852f4 commit 4c9d8d4

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
```java
2+
import java.io.*;
3+
import java.util.*;
4+
5+
public class boj1034 {
6+
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
7+
static StringTokenizer st;
8+
static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());}
9+
static int nextInt() {return Integer.parseInt(st.nextToken());}
10+
11+
public static void main(String[] args) throws Exception {
12+
nextLine();
13+
int N = nextInt();
14+
int M = nextInt();
15+
int answer = 0;
16+
String[] input = new String[N];
17+
for (int i = 0; i < N; i++) input[i] = br.readLine();
18+
HashMap<String, Integer> map = new HashMap<>();
19+
int K = Integer.parseInt(br.readLine());
20+
for (int i = 0; i < N; i++) {
21+
int count = 0;
22+
for (int j = 0; j < M; j++) {
23+
if (input[i].charAt(j) == '0') {
24+
count++;
25+
}
26+
}
27+
if (count <= K && count % 2 == K % 2) {
28+
map.put(input[i], map.getOrDefault(input[i], 0) + 1);
29+
if (map.get(input[i]) > answer) {
30+
answer = map.get(input[i]);
31+
}
32+
}
33+
}
34+
System.out.println(answer);
35+
}
36+
}
37+
```

0 commit comments

Comments
 (0)