Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- int m,n;
- int brojac=0;
- scanf("%d %d",&m,&n);
- int matrica[m][n];
- for(int i=0;i<m;i++){
- for(int j=0;j<n;j++){
- scanf("%d",&matrica[i][j]);
- }
- }
- for(int i=0;i<m;i++){
- for(int j=0;j<n-2;j++){
- if(matrica[i][j]==1&&matrica[i][j+1]==1&&matrica[i][j+2]==1){
- brojac++;
- break;
- }
- }
- }
- for(int j=0;j<n;j++){
- for(int i=0;i<m-2;i++){
- if(matrica[i][j]==1 &&matrica[i+1][j]==1 &&matrica[i+2][j]==1){
- brojac++;
- break;
- }
- }
- }
- printf("%d",brojac);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement