- 选数
- 2013-08-08 07:13:12 @
不容易啊,希望自己能坚持下去~
1 条评论
-
miaoyang LV 8 @ 2014-09-28 11:11:47
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