Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int V[10000];
  5.  
  6. int main() {
  7. int colunas, linhas, x, i, j, lido;
  8. while (1) {
  9. scanf("%d %d %d", &colunas, &linhas, &x);
  10.  
  11. if (colunas == 0 && linhas == 0 && x == 0) break;
  12.  
  13. for (j = 0; j < colunas; j++) {
  14. V[j] = 0;
  15. }
  16.  
  17. int qt = 0;
  18.  
  19. for (i = 0; i < linhas; i++) {
  20. for (j = 0; j < colunas; j++) {
  21. scanf("%d", &lido);
  22. if (lido == 1) {
  23. V[j]++;
  24. } else {
  25. if (V[j] >= x) {
  26. qt++;
  27. }
  28. V[j] = 0;
  29. }
  30. }
  31. }
  32.  
  33. for (j = 0; j < colunas; j++) {
  34. if (V[j] >= x)
  35. qt++;
  36. }
  37.  
  38. printf("%d\n", qt);
  39. }
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement