結果

問題 No.500 階乗電卓
ユーザー hebiyan
提出日時 2017-05-23 17:54:51
言語 OCaml
(5.2.1)
結果
TLE  
実行時間 -
コード長 321 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 21,444 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-10-09 00:01:59
合計ジャッジ時間 7,040 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

let rec fact_mod n mm =
  let rec inner m acc =
    if m = 0 then
      acc
    else
      inner (m - 1) ((m * acc) mod mm) in inner n 1 ;;

let () =
  Scanf.sscanf (read_line ()) "%d"
               (fun n ->
                print_string @@ string_of_int @@ fact_mod n 1000000000000;
                print_string "\n")
0