求每只队伍都回答出题目,且至少有一只队伍回答出n道题的概率
存在性问题我们可以转化为任意性问题
用P(每支队伍都回答出题目)-P(每只队伍回答的题目数小于n)
然后我们可以递推求解
var f:array[..,..,..] of double;
p:array[..,..] of double;
k,i,j,n,m,t:longint;
s,ans,tmp:double; begin
while not eof do
begin
readln(n,t,m);
if (n=) and (t=) and (m=) then break;
for i:= to t do
begin
for j:= to n do
read(p[i,j]);
readln;
end;
fillchar(f,sizeof(f),);
for i:= to t do
begin
f[i,,]:=;
for j:= to n do
begin
f[i,j,]:=f[i,j-,]*(-p[i,j]);
for k:= to j do
f[i,j,k]:=f[i,j-,k-]*p[i,j]+f[i,j-,k]*(-p[i,j]); //f[i,j,k]表示第i支队前j道题答出k题的概率
end;
end;
ans:=;
for i:= to t do
ans:=ans*(-f[i,n,]);
tmp:=;
for i:= to t do
begin
s:=;
for j:= to m- do
s:=s+f[i,n,j]; //答出题目出数<n满足加法原理
tmp:=tmp*s; //每队都小于满足乘法原理
end;
ans:=ans-tmp;
writeln(ans::);
end;
end.