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