Cod sursa(job #18231)
Utilizator | Data | 18 februarie 2007 10:54:11 | |
---|---|---|---|
Problema | Plantatie | Scor | 60 |
Compilator | cpp | Status | done |
Runda | preONI 2007, Runda 2, Clasa a 10-a | Marime | 0.4 kb |
#include <fstream.h>
long a[501][501];
long n,m,i,j,max,l,c,lt,k;
int main()
{
ifstream fin ("plantatie.in");
ofstream fout("plantatie.out");
fin>>n>>m;
for (i=1;i<=n;i++)
for (j=1;j<=n;j++)
fin>>a[i][j];
for (i=1;i<=m;i++)
{ fin>>l>>c>>lt;
max=a[l][c];
for (j=l;j<l+lt;j++)
for (k=c;k<c+lt;k++)
if (a[j][k]>max)
max=a[j][k];
fout<<max<<'\n';
}
return 0;
}