Advertisement
masterm1nd99

dlapki

Dec 4th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int mat[100][100];
  5. int n,m, max=99999;
  6. scanf("%d %d", &m, &n);
  7. for(i=0; i<m+2;i++)
  8. {
  9. for(j=0; j<n+2;j++)
  10. {
  11. mat[i][j]=max;
  12. }
  13. }
  14. for(i=1; i<m+1; i++)
  15. {
  16. for(j=1;j<n+1; j++)
  17. {
  18. scanf("%d %d", &mat[i][j]);
  19. }
  20. }
  21. for(i=1; i<m+1; i++)
  22. {
  23. for(j=1;j<n+1; j++)
  24. {
  25. 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])
  26. {
  27. printf("%d ", mat[i][j]);
  28. }
  29. }
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement