fork download
  1. var M7,M2,M14,MAX,dat,res,i,N: longint;
  2.  
  3. begin
  4.  
  5. M7 := 0;
  6.  
  7. M2 := 0;
  8.  
  9. M14 := 0;
  10.  
  11. MAX := 0;
  12.  
  13. readln(N);
  14.  
  15. for i := 1 to N do
  16.  
  17. begin
  18.  
  19. readln(dat);
  20.  
  21. if ((dat mod 7) = 0) and ((dat mod 2) > 0) and (dat > M7) then
  22.  
  23. M7 := dat;
  24.  
  25. if ((dat mod 2) = 0) and ((dat mod 7) > 0) and (dat > M2) then
  26.  
  27. M2 := dat;
  28.  
  29. if (dat mod 14 = 0) and (dat > M14) then
  30.  
  31. begin
  32.  
  33. if M14 > MAX then MAX := M14;
  34.  
  35. M14 := dat
  36.  
  37. end
  38.  
  39. else
  40.  
  41. if dat > MAX then
  42.  
  43. MAX := dat;
  44.  
  45. end;
  46.  
  47. if (M7*M2 < M14*MAX) then
  48.  
  49. res := M14*MAX
  50.  
  51. else
  52.  
  53. res := M7*M2;
  54.  
  55. writeln(res);
  56.  
  57. end.
Success #stdin #stdout 0s 4492KB
stdin
Standard input is empty
stdout
0