Cod sursa(job #107121)

Utilizator AdyXBucur Andrei AdyX Data 19 noiembrie 2007 11:19:42
Problema Plantatie Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.64 kb
var v: array[1..500, 1..500] of word;
    n, i, j, k, x, y, z, max: word;
    m: longint;
    f, g: text;
begin
     assign(f, 'plantatie.in');
     reset(f);
     readln(f, n, m);
     for i:=1 to n do begin
         for j:=1 to n do
             read(f, v[i, j]);
         readln(f);
     end;
     assign(g, 'plantatie.out');
     rewrite(g);
     for i:=1 to m do begin
         readln(f, x, y, z);
         max:=0;
         for j:=x to x+z-1 do
             for k:=y to y+z-1 do
                 if v[j, k]>max then
                    max:=v[j, k];
         writeln(g, max);
     end;
     close(f);
     close(g);
end.