Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program parcial
- type
- persona = record cadena: string [50] sub: 1..15 sub2: 1..5
- nom : cadena
- dni : integer
- VE : vECcd
- DIML : INTEGER;
- end;
- VecC: array [sub] of integer
- VecV: array [1..250] of persona
- VecCD: array [Sub2] of sub
- var
- VP: VecV;
- VC: VecC;
- dimlP: integer;
- begin
- dimlp:= 0
- CargarVector (VP,dimlp);
- Inicializar (VC);
- ProcesarPersonas (VP, dimlp, VC);
- CalcMax (vC);
- end;
- procedure CargarVector (var VP: vecV; var dimlp: integer);
- var
- p: persona;
- begin
- Leer (P);
- while (p.dni <> 0) do begin
- dimlp:= dimlp+1;
- VP[dimlp]:= p;
- Leer (P);
- end;
- end;
- procedure Inicializar (var VC: VecC);
- var
- i: integer;
- begin
- for i:= 1 to 15 do
- VC[i]:= 0;
- end;
- procedure Leer (var P:persona);
- var
- cod: integer;
- begin
- read (p.dni);
- if (p.dni <> 0) then begin
- read (p.nom);
- p.diml:= 0;
- read (cod);
- while (cod <> 0) do begin
- p.diml := p.diml+1
- p.VE[p.diml]:= cod;
- read (cod);
- end;
- end;
- end;
- procedure ProcesarPersonas (VP: VecV; dimlp: integer; var VC: VecC);
- var
- i,cantp: integer;
- begin
- cantp:= 0;
- for i:= 1 to dimlp do
- ContarPersona (VP[i], VC, cantp);
- writeln (Cantp);
- end;
- procedure ContarPersona (p: persona; var VC: VecC; var cantp: integer);
- var
- i: integer;
- begin
- for i:= 1 to p.diml do
- VC[p.VE[i]]:= VC [p.VE[i]]+1;
- if (p.diml >= 3) then
- cantp:= cantp+1;
- end;
- procedure CalcMax (VC: VecC);
- var
- i, max, EspMax: integer;
- begin
- max:= -1;
- for i:= 1 to 15 do begin
- if (VC[i] > max) then begin
- max:= VC[i];
- EspMax:= i;
- end;
- end;
- writeln (EspMax);
- end;
Add Comment
Please, Sign In to add comment