Pagini recente » Cod sursa (job #2259594) | Cod sursa (job #2238475) | Cod sursa (job #2670100) | Cod sursa (job #2315904) | Cod sursa (job #674237)
Cod sursa(job #674237)
var p:array[1..26] of real;
b:array[1..26] of longint;
pt,pp,a:real;
n,k,m,i,j,c: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>k then
begin
a:=1;
for j:=1 to k do a:=a*p[b[j]];
pt:=pt+(a*(n-k));
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.