Pagini recente » Cod sursa (job #2329598) | Cod sursa (job #2151616) | Cod sursa (job #1841903) | Cod sursa (job #404011) | Cod sursa (job #674236)
Cod sursa(job #674236)
var p:array[1..26] of real;
b:array[1..26] of longint;
pt,pp,a:real;
n,k,m,i,j:longint;
o,d:text;
function check(ii:longint):boolean;
var i:longint;
begin
check:=true;
for i:=1 to ii-1 do if b[i]=b[ii] then check:=false;
end;
procedure comb(po:longint);
var i,j:longint;
begin
if po>n then
begin
a:=1;
for j:=1 to k do a:=a*p[b[j]];
pt:=pt+a;
m:=m+1;
end
else for i:=1 to n do
begin
b[po]:=i;
if check(po) then comb(po+1);
end;
end;
begin
m:=0;
pt:=0;
assign(d,'dezastru.in');assign(o,'dezastru.out');
reset(d);rewrite(o);
read(d,n);readln(d,k);
for i:=1 to n do read(d,p[i]);
comb(1);
pt:=pt/m;
write(o,pt:7:6);
close(o);close(d);
end.