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