Cod sursa(job #93412)
Utilizator | dan horia bobo_2 | Data | 18 octombrie 2007 19:30:01 |
---|---|---|---|
Problema | Plantatie | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include<fstream.h>
long a[500][500],i,j,n,m,l,max;
ifstream f("plantatie.in");
ofstream g("plantatie.out");
int valoare(int x,int y,int l)
{ long b,c; max=0;
for(c=x;c<l+x;c++)
for(b=y;b<l+y;b++)
{ if(a[c][b]>max) max=a[c][b];
}
return max;
}
int main()
{ long o,oo,ooo;
f>>n>>m;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
f>>a[i][j];
for(i=1;i<=m;i++)
{ f>>o>>oo>>ooo;
valoare(o,oo,ooo);
g<<max<<"\n";
}
f.close();
g.close();
return 0;
}