llirik

БУ стрим #22

Nov 20th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.56 KB | None | 0 0
  1. var
  2.     mn, mx: array [0..59] of integer;
  3.     i, n, x, res1, res2, res: integer;
  4. begin
  5.     readln(n);
  6.     for i:=0 to 59 do begin
  7.         mx[i] := 0; mn[i] := 10001;
  8.     end;
  9.     for i:=1 to n do
  10.     begin
  11.         readln(x);
  12.         if x > mx[x mod 60] then mx[x mod 60] := x;
  13.         if x < mn[x mod 60] then mn[x mod 60] := x;
  14.     end;
  15.     res := -1;
  16.     for i:=0 to 59 do begin
  17.         if ((mx[i] - mn[i]) > res) and (mn[i] <> mx[i]) and (mx[i] <> 0) then
  18.         begin
  19.             res := mx[i] - mn[i];
  20.             res1 := mn[i]; res2 := mx[i];
  21.         end;
  22.     end;
  23.     if res = -1 then writeln ('00')
  24.     else writeln (res1, ' ', res2);
  25. end.
Add Comment
Please, Sign In to add comment