結果

問題 No.502 階乗を計算するだけ
ユーザー arito_asuarito_asu
提出日時 2020-07-10 20:35:10
言語 OCaml
(5.1.0)
結果
RE  
実行時間 -
コード長 368 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 21,580 KB
実行使用メモリ 815,488 KB
最終ジャッジ日時 2024-04-17 09:06:39
合計ジャッジ時間 2,832 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 WA -
testcase_22 MLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

let rec synergy x =
    if (Array.length x) < 2 then x.(0)
    else x.(0) * (synergy (Array.sub x 1 ((Array.length x) - 1)));;

let factorial n =
    (synergy (Array.init n (fun x -> x + 1)));;

let rec pow x y =
    if y == 1 then x
    else x * (pow x (y - 1));;
    
print_endline @@ string_of_int @@ Scanf.scanf "%d" (fun x -> (factorial x) mod ((pow 10 9) + 7));;
0