Cod sursa(job #331817)
Utilizator | Data | 15 iulie 2009 13:37:10 | |
---|---|---|---|
Problema | Plantatie | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include<stdio.h>
#define nmax 512
int n,m[nmax][nmax],max,a,b,c;
int main()
{
int t;
freopen("plantatie.in","r",stdin);
freopen("plantatie.out","w",stdout);
scanf("%d%d",&n,&t);
for(int i=1;i<=n;++i)
for(int j=1;j<=n;++j)
scanf("%d",&m[i][j]);
for(;t;--t)
{
scanf("%d%d%d",&a,&b,&c);
max=0;
for(int i=a;i-a<c;++i)
for(int j=b;j-b<c;++j)
if (max<m[i][j])
max=m[i][j];
printf("%d\n",max);
}
return 0;
}