很正确。我写了三个程序。第一个程序和第二个结果不一样,很诡异 @RISC @howfar @carmanlee @wtl
第一个程序,第二次断在右侧,能拼成三角形的概率是19.3%
第二个程序,第二次可能断在右侧,也可能断在左侧,能拼成三角形的概率是17%
第三个程序,同时断裂,答案25%
% 程序一
try_num = 1e5;
a = rand(1,try_num);
b = rand(1,try_num).*(1-a);
c= 1-a-b;
abc = [a; b; c];
abc_sort = sort(abc);
good = 0;
for ite = 1:try_num
if abc_sort(3,ite) < 0.5
good = good+1;
end
end
ratio1 = good/try_num
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 程序二
clear all
try_num = 1e5;
a = rand(1,try_num);
for ite =1:try_num
if rand > 0.5
b(ite) = rand.*(1-a(ite));
else
b(ite) = rand.*a(ite);
end
end
c= 1-a-b;
abc = [a; b; c];
abc_sort = sort(abc);
good = 0;
for ite = 1:try_num
if abc_sort(3,ite) < 0.5
good = good+1;
end
end
ratio2 = good/try_num
%%%%%%%%%%%%%%%%%%%
% 程序三
clear all
try_num = 1e9;
a = rand(2,try_num);
b = sort(a);
b0 = zeros(1,try_num);
b1 = ones(1,try_num);
bt = [b0; b ; b1];
c = diff(bt);
d = max(c);
ind = find(d<0.5);
ratio3 = length(ind)/try_num
【 在 fayewong 的大作中提到: 】
: y不一定断在另一节啊
--
修改:novicer FROM 49.93.126.*
FROM 49.93.126.*