Pagini recente » Cod sursa (job #1654722) | Cod sursa (job #1287878) | Cod sursa (job #844013) | Cod sursa (job #1985504) | Cod sursa (job #331803)
Cod sursa(job #331803)
#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;
}