SHARE
TWEET

Untitled

a guest May 21st, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Var ost:array [0..5] of integer = (1000000,100000,100000,100000,100000,1000000);
  2. n,i,a1,a2,minS:integer;
  3. Begin
  4.       minS:= 10000000;
  5.       readln(n);
  6.       readln(a1);
  7.       for i:=2 to n do
  8.       begin
  9.             ost[a1 mod 6] := min(ost[a1 mod 6],a1);
  10.             readln(a2);
  11.             if ((a2 + ost[a1 mod 6]) mod 6 = 0)  then
  12.             else
  13.             minS:=min(minS,a2 + ost[a1 mod 6]);
  14.             a1 := a2;
  15.        end;
  16.        writeln(minS);
  17. 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