var n,i,m,pp,a:integer;
Begin
pp:=0;
m:=0;
Readln(n);
for i:=1 to n do Begin
Readln(a);
if (pp=0) and (a mod 3=0) then Begin
pp:=1;
m:=a;
end;
if (pp=1) and (a mod 3=0) and (a<m) then m:=a;
Writeln(m);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var n,i,m,pp,a:integer;
Begin
pp:=0;
m:=0;
Readln(n);
for i:=1 to n do Begin
Readln(a);
if (pp=0) and (a mod 3=0) then Begin
pp:=1;
m:=a;
end;
if (pp=1) and (a mod 3=0) and (a<m) then m:=a;
end;
Writeln(m);
end.