电脑的笔记...
不敢用邮件发回家...怕病毒
var a:array[1..60000]of boolean;
b:array[1..200]of longint;
c:array[1..200]of boolean;
i,k,n,j,max:longint;
procedure dg(t,s:longint);
var i:integer;
begin
if s>max then max:=s;
if c[t]=false then begin dg(t+1,s);exit; end;
for i:=t+1 to n do
if (c[i])and(a[b[t]+b[i]]) then
begin
c[i]:=false;
dg(t+1,s+1);
c[i]:=true;
end
else dg(t+1,s);
end;
begin
readln(n);
for i:=1 to n do
read(b[i]);
fillchar(a,sizeof(a),true);
a[1]:=false;
for i:=2 to 60000 do
if a[i] then
for j:=2 to 60000 div i do
a[i*j]:=false;
fillchar(c,sizeof©,true);
dg(1,0);
writeln(max);
end.
不敢用邮件发回家...怕病毒
var a:array[1..60000]of boolean;
b:array[1..200]of longint;
c:array[1..200]of boolean;
i,k,n,j,max:longint;
procedure dg(t,s:longint);
var i:integer;
begin
if s>max then max:=s;
if c[t]=false then begin dg(t+1,s);exit; end;
for i:=t+1 to n do
if (c[i])and(a[b[t]+b[i]]) then
begin
c[i]:=false;
dg(t+1,s+1);
c[i]:=true;
end
else dg(t+1,s);
end;
begin
readln(n);
for i:=1 to n do
read(b[i]);
fillchar(a,sizeof(a),true);
a[1]:=false;
for i:=2 to 60000 do
if a[i] then
for j:=2 to 60000 div i do
a[i*j]:=false;
fillchar(c,sizeof©,true);
dg(1,0);
writeln(max);
end.