Advertisement
Guest User

Kontrolinis

a guest
Jan 19th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.63 KB | None | 0 0
  1. program U1;
  2. type Pora = record
  3.     Vardai : string;
  4.     Balsai : integer;
  5.     end;
  6.  
  7. var input,output : textfile;
  8.     Por : Array [1..100] of Pora;
  9.     i,N,M : integer;
  10.  
  11. procedure ReadX(x : integer;var ats : Pora);
  12.     var a,j,min,max,aa : integer;
  13.         em : string;
  14.     begin
  15.     aa:=0;
  16.     ReadLn(input,ats.Vardai);
  17.  
  18.     for j:=1 to 2 do
  19.         begin
  20.         min:=999;
  21.         max:=0;
  22.         for i:=1 to x do
  23.             begin
  24.             Read(input,a);
  25.             aa:=aa+a;
  26.             if a < min then
  27.                 min:=a;
  28.             if a > max then
  29.                 max:=a;
  30.             end;
  31.         aa:=aa-max-min;
  32.         end;
  33.     ReadLn(input,em);
  34.     ats.Balsai:=aa;
  35.     end;
  36.  
  37.  
  38.  
  39. begin
  40.   Assign(input,'U2.txt');
  41.   Reset(input);
  42.  
  43.   Assign(output,'U2rez.txt');
  44.   Rewrite(output);
  45.  
  46.   Read(input,N);
  47.   ReadLn(input,M);
  48.  
  49.   for i:=1 to 0 do
  50.     begin
  51.     ReadX(N,Por[i])
  52.     end;
  53.  
  54.   ReadX(N,Por[1]);
  55.   ReadX(N,Por[2]);
  56.   ReadX(N,Por[3]);
  57.   ReadX(N,Por[4]);
  58.   ReadX(N,Por[5]);
  59.   ReadX(N,Por[6]);
  60.   ReadX(N,Por[7]);
  61.   ReadX(N,Por[8]);
  62.   ReadX(N,Por[9]);
  63.   ReadX(N,Por[10]);
  64.   ReadX(N,Por[11]);
  65.   ReadX(N,Por[12]);
  66.   ReadX(N,Por[13]);
  67.   ReadX(N,Por[14]);
  68.   ReadX(N,Por[15]);
  69.   ReadX(N,Por[16]);
  70.   ReadX(N,Por[17]);
  71.   ReadX(N,Por[18]);
  72.   ReadX(N,Por[19]);
  73.   ReadX(N,Por[20]);
  74.   ReadX(N,Por[21]);
  75.   ReadX(N,Por[22]);
  76.   ReadX(N,Por[23]);
  77.  
  78.   for i:=1 to 100 do
  79.       if Por[i].Vardai <> '' then
  80.           begin
  81.  
  82.             Write(output,Por[i].Vardai);
  83.             Write(output,Por[i].Balsai:10);
  84.             WriteLn(output,'');
  85.           end;
  86.   close(output);
  87.   close(input);
  88. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement