SHARE
TWEET

LInii code

BorjanCrvenkov Jan 24th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.  
  5.     int m,n;
  6.     int brojac=0;
  7.     scanf("%d %d",&m,&n);
  8.     int matrica[m][n];
  9.     for(int i=0;i<m;i++){
  10.         for(int j=0;j<n;j++){
  11.         scanf("%d",&matrica[i][j]);
  12.         }
  13.     }
  14.     for(int i=0;i<m;i++){
  15.         for(int j=0;j<n-2;j++){
  16.             if(matrica[i][j]==1&&matrica[i][j+1]==1&&matrica[i][j+2]==1){
  17.             brojac++;
  18.                 break;
  19.             }
  20.         }
  21.     }
  22.     for(int j=0;j<n;j++){
  23.         for(int i=0;i<m-2;i++){
  24.             if(matrica[i][j]==1 &&matrica[i+1][j]==1 &&matrica[i+2][j]==1){
  25.             brojac++;
  26.                 break;
  27.             }
  28.         }
  29.     }
  30.     printf("%d",brojac);
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top