-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1034.cpp
More file actions
40 lines (32 loc) · 707 Bytes
/
1034.cpp
File metadata and controls
40 lines (32 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
#include<vector>
#include<algorithm>
#define N 55
using namespace std;
int n, m, k;
string lamp[N];
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int i, j, ans=0;
cin >> n >> m;
for(i=1; i<=n; i++) cin >> lamp[i];
cin >> k;
for(i=1; i<=n; i++){
int zeros=0;
for(j=0; j<m; j++){
if(lamp[i][j]=='0') zeros++;
}
if(k>=zeros && (k-zeros)%2==0){
int candi=1;
for(j=i+1; j<=n; j++){
if(lamp[i].compare(lamp[j])==0)
candi++;
}
ans = max(ans, candi);
}
}
cout << ans;
return 0;
}