2012-12-06から1日間の記事一覧

匿名質問の確率の問題をRubyで解いてみた。

匿名質問の確率の問題をRubyで解いてみました。(^_^;●probability01.rb # encoding: Shift_JIS # probability01.rb require "mathn" total=0 c0=c1=c2=c3=0 for a in 1..3 do # 1:A; 2:B; 3:C for b in 1..3 do for c in 1..3 do cnt=0 total+=1 cnt+=1 if a…