fork(1) download
  1. #include <cstdio>
  2. #include <cstring>
  3. char c[52][52];
  4. int main(){
  5. int max = 0, cnt = 0;
  6. int n, m, l;
  7. int cnt2;
  8. scanf("%d%d", &n, &m);
  9. for(int i = 0; i < n; i++){
  10. scanf("%s", c[i]);
  11. }
  12. scanf("%d", &l);
  13. for (int i = 0; i < n; i++){
  14. cnt = 0;
  15. cnt2 = 0;
  16. for (int k = 0; k < m; k++) if(c[i][k] == '0') cnt2++;
  17. if (cnt2 <= l && cnt2 % 2 == l % 2) {
  18. for (int j = 0; j < n; j++){
  19. if (strcmp(c[i], c[j]) == 0) cnt++;
  20. }
  21. }
  22. max = max < cnt ? cnt : max;
  23. }
  24. printf("%d\n",max);
  25. }
  26.  
Success #stdin #stdout 0s 3472KB
stdin
3 2
01
10
10
1
stdout
2