-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1034.cpp
45 lines (38 loc) · 787 Bytes
/
1034.cpp
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
41
42
43
44
45
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
int width, height;
int ans = -1;
string arr[50];
cin >> height >> width;
for (int i = 0; i < height; i++)
cin >> arr[i];
int k;
cin >> k;
for (int i = 0; i < height; i++)
{
int cnt = 0;
for (int j = 0; j < width; j++)
{
if (arr[i][j] == '0')
cnt++;
}
int sum = 0;
if (cnt <= k && cnt % 2 == k % 2)
{
for (int y = 0; y < height; y++)
{
if (arr[i] == arr[y])
{
sum++;
}
}
}
ans = max(sum, ans);
}
cout << ans << "\n";
return 0;
}