Skip to content

Instantly share code, notes, and snippets.

@horvathgyozo
Created September 28, 2016 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horvathgyozo/9717ab631dfb9fcb4954d8a093d83400 to your computer and use it in GitHub Desktop.
Save horvathgyozo/9717ab631dfb9fcb4954d8a093d83400 to your computer and use it in GitHub Desktop.
Algtanl: madaras feladat (tételek összeépítése óra, 4. gyakorlat)
program untitled;
const MAXN = 200;
MAXM = 50;
type Tmdb = array[1..MAXM,1..MAXN] of integer;
var n, m: integer; //spec be
mdb: Tmdb; //spec be
maxv: integer; //spec ki
procedure beolvasas(var m, n: integer; var mdb: Tmdb);
var i, j: integer;
begin
readln(m,n);
for i:=1 to m do begin
for j:=1 to n do begin
read(mdb[i,j]);
end;
readln;
end;
end;
procedure kiiras(const maxv: integer);
begin
writeln(maxv);
end;
procedure maxmadar(const m,n: integer;
const mdb: Tmdb;
var maxv: integer);
var i: integer;
function ossz(const i: integer): longint;
var j: integer;
s: longint;
begin
s := 0;
for j:=1 to n do begin
s:=s+mdb[i,j];
end;
ossz:=s;
end;
begin
maxv := 1;
for i:=2 to m do begin
if ossz(i)>ossz(maxv) then begin
maxv := i;
end;
end;
end;
begin
beolvasas(m, n, mdb);
maxmadar(m,n,mdb,maxv);
kiiras(maxv);
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment