Pagini recente » Cod sursa (job #181928) | Cod sursa (job #835526) | Cod sursa (job #2884644) | Cod sursa (job #1938519) | Cod sursa (job #331816)
Cod sursa(job #331816)
#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;
}