讨论 / 如何错
李一恒 2009-02-02 17:49:00
点我顶贴 收藏 删除
var i,j,k,s,n:integer;a:boolean;

function sushu(n:integer):boolean;

begin

a:=true;

for i:=2 to trunc(sqrt(n)) do if n mod i=0 then a:=false;

sushu:=a;

end;

begin

read(n);

for k:=4 to n do begin

if k mod 2=0 then

for j:=2 to k do

if sushu(j) then begin

n:=k-j;

if n>1 then

if sushu(n) then begin write(k,’=’,j,’+’,n);writeln;break;end;

end;

end;

j:=n;

for i:=2 to j-1 do

if j mod 2=0 then

if sushu(i) then

if sushu(j-i) then

if n-i>1 then write(n,’=’,j,’+’,n-j);

if n mod 2=0 then

j:=n+2 else j:=n+1;

for i:=2 to j-1 do

if j mod 2=0 then

if sushu(i) then

if sushu(j-i) then

if n-i>1 then write(n,’=’,j,’+’,n-j);

end.

查看更多回复
提交回复