请问#7#10是什么,能帮我看看为什么八十分吗?

P1579 哥德巴赫猜想(升级版)

CodePandorum @ 2016-11-28 19:08:47

var
a,b,c,u:longint;
d:array[1..3]of longint;
begin
read(a);
d[1]:=a-2;
repeat
repeat
d[1]:=d[1]-2;
c:=0;
for b:=3 to d[1]-1 do
if d[1] mod b = 0 then c:=1;
until c<>1;
d[2]:=1;
repeat
repeat
d[2]:=d[2]+1;
u:=0;
for b:=2 to d[2]-1 do
if d[2] mod b = 0 then u:=1;
if u=0 then break;
until d[2]=100000000;
d[3]:=a-d[1]-d[2];
u:=0;
for b:=2 to d[3]-1 do
if d[3] mod b = 0 then u:=1;
if u=0 then begin
if d[2]<=d[3] then write(d[2],' ',d[3],' ',d[1])
else write(d[3],' ',d[2],' ',d[1]);
break;
end;
until u=0;
if u=0 then break;
until u=1000;
end.

by captainbear @ 2016-11-28 19:38:42

var
n,i,j:longint;
function check(temp:longint):boolean;
var
xx:longint;
begin
if temp<2 then exit(false);
for xx:= 2 to trunc(sqrt(temp)) do
if temp mod xx=0 then exit(false);
exit(true);
end;
begin
readln(n);
for i:= 2 to n-1 do
if check(i) then 
for j:= 2 to n-i do
if (check(j)) and (check(n-i-j)) then begin
writeln(i,' ',j,' ',n-i-j);
halt;
end;
end.

|