結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー ichibanshiboriichibanshibori
提出日時 2016-10-09 17:11:03
言語 OCaml
(5.1.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 20,724 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 08:34:32
合計ジャッジ時間 1,168 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 WA -
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let sosu_dice = [13; 11; 7; 5; 3; 2;]
let comp_dice = [12; 10; 9; 8; 6; 4;]

let rec can_divide n lst =
  match lst with
  | [] -> None
  | x::xs ->
    if n mod x = 0 then Some (n / x)
    else can_divide n xs

let () =
  let k = read_int () in
  let ans = match can_divide k sosu_dice with
  | None -> 0.
  | Some x ->
    match can_divide x comp_dice with
    | None -> 0.
    | Some 1 -> 1. /. 36.
    | _ -> 0.
  in
  Printf.printf "%0.13f\n" ans
0