File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments