Varianta 100 / Subiectul 2 / Problema 5 |
#include<fstream.h> fstream f("date.in", ios::in); fstream g("date.out" , ios::out); void main() { int i,j,n; long a[100][100]; long max=1000000000; f>>n; for(i=1;i<=n;i++) for(j=1;j<=n;j++) f>>a[i][j]; for(i=0;i<=n+1;i++) a[0][i]=a[i][0]=a[i][n+1]=a[n+1][i]=max; for(i=1;i<=n;i++) for(j=1;j<=n;j++) if(a[i][j]<a[i-1][j] && a[i][j]<a[i][j-1] && a[i][j]<a[i+1][j] && a[i][j]<a[i][j+1]) g<<a[i][j]<<" "; } |