Hydra_ @ 2016-10-24 11:16:16
var n,i,j:longint;a:array[1..3]of longint;
function check(nn:longint): boolean;
var i:longint;
begin
for i:=2 to trunc(sqrt(nn)) do
if nn mod i =0 then exit(false);
exit(true);
end;
procedure print;
begin
write(a[1],' ',a[2],' ',a[3]);
halt;
end;
begin
read(n);
for i:=2 to n-4 do
if check(i) then
begin
a[1]:=i;
for j:=2 to n-i do
if (check(j)) and (check(n-i-j)) then
begin
a[2]:=j;
a[3]:=n-i-j;
print;
end;
end;
end.
by sanakk @ 2016-11-28 12:48:55
判断n是不是小于2,如果是就直接退出