a=rand(1..6)
b=(6.00-a)/6.00
print "如果A掷出#{a}点,那么B胜出的概率是: "
puts (6-a).to_s+"/6"
6.times do |i|
if (i+1)>a && (i+1)<=6
arr.push i+1
end
end
print "可能情况是:"
p arr
print "B赢的概率是:"
print (b*100).round.to_s+'%'
puts
熊志男 2013-04-02
which company?
刘俊 2013-04-04
甘隆琴 2013-04-08
对我来说是高难度。。。
晏佳 2013-04-09
这是要概率建模呀