Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #define MAX 100
  3. int main ()
  4. {
  5. int matrica[100][100];
  6. int i,j;
  7. int redica,kolona;
  8. int count2=0,count4=0;
  9.  
  10. scanf("%d %d",&redica,&kolona);
  11. for(i=0;i<redica;i++)
  12. for(j=0;j<kolona;j++)
  13. scanf("%d",&matrica[i][j]);
  14. // Vcituvanje na matricata // KRAJ //
  15.  
  16. // Pocetok na prvrtuvanje na matricata
  17. for (i=0;i<redica;i++)
  18. {
  19. int count=0;
  20. for(j=0;j<kolona;j++)
  21. {
  22. if(matrica[i][j]==1)
  23. {
  24. count++;
  25. }
  26. else
  27. {
  28. if(count>=3)
  29. {
  30. count2++;
  31. break;
  32. }
  33. count=0;
  34. }
  35. }
  36. }
  37. // KOLONIII ! KRAJ !
  38.  
  39. for (j=0;j<kolona;j++)
  40. {
  41. int count3=0;
  42. for(i=0;i<redica;i++)
  43. {
  44. if(matrica[i][j]==1)
  45. {
  46. count3++;
  47. }
  48. else
  49. {
  50. if(count3>=3)
  51. {
  52. count4++;
  53. break;
  54. }
  55. count3=0;
  56. }
  57. }
  58. }
  59. printf("%d",count2+count4);
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement