【发布时间】:2011-07-22 16:35:37
【问题描述】:
如何确定函数在以下情况下返回 0 或 1 的概率:
让
function_A返回 0 概率 40% 和 1 概率 60%。生成一个function_B概率 50-50 仅使用function_A仅限。
我想到了以下几点:
function_B()
{
int result1=function_A();
int result2=function_A();
//two times 40% would result in 16% and 40%+60% would be 24%... two times 60% would be 36%
}
什么组合可以得到 50-50?
【问题讨论】:
-
这是作业吗?如果你应该为作业做这个,我不想直接告诉你答案。
-
不,不是作业...我无法通过两个函数调用来回答..
标签: c algorithm math puzzle probability