Pagini recente » Cod sursa (job #1533579) | Cod sursa (job #2761126) | Cod sursa (job #320023) | Cod sursa (job #798209) | Cod sursa (job #574437)
Cod sursa(job #574437)
var a:array[1..25] of real;
x:array[0..25] of byte;
i,n,k,p,y,z,q:longint;
s,pr:real;
procedure back(t:integer);
var i:integer;
begin
for i:=x[t-1]+1 to n do
begin
x[t]:=i;
pr:=pr*x[t];
if t=k then s:=s+pr
else back(t+1);
pr:=pr/x[t];
end;
end;
begin
assign(input,'dezastru.in');reset(input);
assign(output,'dezastru.out');rewrite(output);
readln(n,k);
for i:=1 to n do read(a[i]);
s:=0;pr:=1;
back(1);
for i:=n downto 1 do
begin
s:=s/i;
if i<=k then s:=s*i;
if i<=n-k then s:=s*i;
end;
write(s:0:6);
end.