結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー ichibanshibori
提出日時 2016-10-09 17:11:03
言語 OCaml
(5.2.1)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 20,724 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-08 23:51:58
合計ジャッジ時間 1,159 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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