結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー cielciel
提出日時 2015-05-22 22:32:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 109 ms / 5,000 ms
コード長 244 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 11,332 KB
実行使用メモリ 16,512 KB
最終ジャッジ日時 2023-09-20 09:30:13
合計ジャッジ時間 2,225 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,252 KB
testcase_01 AC 84 ms
15,076 KB
testcase_02 AC 84 ms
15,228 KB
testcase_03 AC 84 ms
15,024 KB
testcase_04 AC 92 ms
15,644 KB
testcase_05 AC 109 ms
16,512 KB
testcase_06 AC 99 ms
16,044 KB
testcase_07 AC 100 ms
16,040 KB
testcase_08 AC 86 ms
15,224 KB
testcase_09 AC 86 ms
15,080 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

A=[2,3,5,7,11,13]
B=[4,6,8,9,10,12]
P,C=gets.split.map(&:to_i)
h={1=>1.0}
P.times{
	x=Hash.new(0)
	h.each{|k,v|A.each{|e|x[k*e]+=v/6.0}}
	h=x
}
C.times{
	x=Hash.new(0)
	h.each{|k,v|B.each{|e|x[k*e]+=v/6.0}}
	h=x
}
p h.reduce(0){|s,(k,v)|s+=k*v}
0