Cod sursa(job #94012)
| Utilizator | Data | 21 octombrie 2007 13:02:08 | |
|---|---|---|---|
| Problema | Plantatie | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include<fstream.h>
long int n,m,a[510][510];
int max(int x,int y,int z)
{ long int p=0;
for(int i=x;i<x+z;i++)
for(int j=y;j<y+z;j++)
if(a[i][j]>p) p=a[i][j];
return p;
}
int main ()
{ long int l,c,k;
ifstream f("plantatie.in");
ofstream g("plantatie.out");
f>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
f>>a[i][j];
while(m){ f>>l>>c>>k;
g<<max(l,c,k)<<"\n";
m--;
}
f.close();
g.close();
return 0;
}