結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー yuruhiyayuruhiya
提出日時 2020-07-18 21:04:38
言語 Crystal
(1.10.0)
結果
AC  
実行時間 3,742 ms / 5,000 ms
コード長 293 bytes
コンパイル時間 20,294 ms
コンパイル使用メモリ 259,832 KB
実行使用メモリ 4,896 KB
最終ジャッジ日時 2023-09-13 11:15:24
合計ジャッジ時間 25,916 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,520 KB
testcase_01 AC 5 ms
4,836 KB
testcase_02 AC 3 ms
4,480 KB
testcase_03 AC 3 ms
4,896 KB
testcase_04 AC 106 ms
4,880 KB
testcase_05 AC 3,742 ms
4,832 KB
testcase_06 AC 623 ms
4,836 KB
testcase_07 AC 627 ms
4,848 KB
testcase_08 AC 4 ms
4,824 KB
testcase_09 AC 4 ms
4,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = read_line.split.map &.to_i
ans = 0.0
count = 6 ** (a + b)
[2, 3, 5, 7, 11, 13].each_repeated_permutation(a) do |x|
  [4, 6, 8, 9, 10, 12].each_repeated_permutation(b) do |y|
    ans += x.reduce(1i64) { |acc, v| acc * v } * y.reduce(1i64) { |acc, v| acc * v } / count
  end
end
puts ans
0