- 选数
- 2009-02-08 11:08:42 @
var a,b:array[0..20]of longint;
v:array[1..20]of boolean;
n,k,i:integer;
sum:int64;
function check(a:longint):boolean;
var i:longint;
begin
for i:=2 to trunc(sqrt(a)) do
if a mod i=0 then exit(false);
exit(true);
end;
procedure solve(i:integer);
var j:integer;
m:longint;
begin
if i=k+1 then
begin
m:=0;
for j:=1 to k do inc(m,b[j]);
if check(m) then inc(sum);
exit
end;
for j:=1 to n do
if (not v[j])and(b
4 条评论
-
481024 LV 7 @ 2015-02-13 11:33:35
good!
god!
gd!
g!
! -
2015-02-13 11:33:13@
呵呵呵呵呵额呵呵呵
-
2015-02-13 11:33:05@
呵呵
-
2014-09-28 11:11:58@
var
si,xi:array[1..20] of longint;
j,t,c,d,e,f,g,n,k:longint;
procedure my;
begin
for c:=1 to k do
d:=si[xi[c]]+d;
for e:=2 to d-1 do
if d mod e=0 then
begin
f:=1;
break;
end;
if f=0 then g:=g+1;
f:=0;
d:=0;
j:=k;
while (j>0)and(xi[j]=n+j-k) do
j:=j-1;
if j>0 then
begin
inc(xi[j]);
for t:=j+1 to k do
xi[t]:=xi[t-1]+1;
end;
end;
begin
readln(n,k);
for j:=1 to n do
read(si[j]);
for j:=1 to k do
xi[j]:=j;
while j<>0 do
my;
writeln(g);
end.
- 1