public class BOJ1034 {
/**
* 14 3
* 001
* 101
* 001
* 000
* 111
* 001
* 101
* 111
* 110
* 000
* 111
* 010
* 110
* 001
* 6
*/
static String[] grid;
static int N;
static int M;
static int K;
static int max;
static int result = 0;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
M = Integer.parseInt(st.nextToken());
grid = new String[N];
int[] rampOff = new int[N];
for(int i = 0; i < N; i++){
String num = br.readLine();
for(int j = 0; j < M; j++){
if(num.charAt(j) == '0'){
rampOff[i]++;
}
grid[i] = num;
}
}
K = Integer.parseInt(br.readLine());
int max = 0;
for(int i = 0; i < N; i++){
if(rampOff[i] <= K && (K - rampOff[i]) % 2 == 0){
int count = 1;
for(int j = 0; j < N; j++){
if(i != j){
if(grid[i].equals(grid[j])){
count++;
}
}
}
max = Math.max(count, max);
}
}
System.out.println(max);
}
}
'PS > 백준' 카테고리의 다른 글
[백준] 트럭 - Java 13335 (0) | 2024.10.24 |
---|---|
[백준] 우주 탐사선 - Java 17182 (0) | 2024.10.21 |
[백준] 센티와 마법의 뿅망치 - Java 19683 (0) | 2024.10.10 |
[백준] 풍선 터트리기 - Java 32377 (0) | 2024.10.02 |
[백준] 두수의 합 - Java 9024 (0) | 2024.10.02 |