var n,i:longint;
Function check(n:longint):boolean;
var i:longint;
begin
check:=true;
for i:=2 to trunc(sqrt(n)) do
if n mod i=0 then begin check:=false; exit; end;
end;
Begin
readln(n);
if n mod 10=9 then n:=n+1;
if (n<19) and (n>=7) then begin writeln('2 3 5 7'); exit; end;
i:=n-(n mod 10)-9;
while i>0 do
begin
if check(i) and check(i+2) and check(i+6) and check(i+8) then begin writeln(i,' ',i+2,' ',i+6,' ',i+8); exit; end;
i:=i-10;
end;
end.
Бидний гаргасан амжилтууд (Team SMCS1)
12 лет назад
Комментариев нет:
Отправить комментарий