daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var
  2.     m, m2, m13, m26, ans, i, n, a:integer;
  3. function max(a,b:integer):integer;
  4. begin
  5.     if (a > b) then max:=a
  6.     else max:=b;
  7. end;
  8.  
  9. begin
  10.     m := 0;
  11.     m2 := 0;
  12.     m13 := 0;
  13.     m26 := 0;
  14.    
  15.     read(n);
  16.     for i:=1 to n do begin
  17.         read(a);
  18.         if (a mod 26 = 0) then begin
  19.             if (a >= m26) then m := max(m, m26);
  20.             m26 := max(m26, a);
  21.         end else begin
  22.             if (m mod 2 = 0) then m2 := max(m2, a)
  23.             else if (m mod 13 = 0) then m13 := max(m13, a)
  24.             else m := max(m, a);      
  25.         end;
  26.      end;
  27.      
  28.      m := max(m, max(m2, m13));
  29.      ans := max(m2 * m13, m * m26);
  30.      
  31.      read(a);
  32.      if (a = ans) then writeln('Контроль пройден.')
  33.      else writeln('Контроль не пройден.');
  34. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top