結果

問題 No.502 階乗を計算するだけ
ユーザー momen999momen999
提出日時 2017-04-16 10:04:01
言語 Haskell
(9.8.2)
結果
MLE  
実行時間 -
コード長 279 bytes
コンパイル時間 1,029 ms
コンパイル使用メモリ 157,276 KB
実行使用メモリ 820,268 KB
最終ジャッジ日時 2023-09-26 08:57:39
合計ジャッジ時間 6,339 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,248 KB
testcase_01 AC 2 ms
7,168 KB
testcase_02 AC 2 ms
7,088 KB
testcase_03 AC 3 ms
7,160 KB
testcase_04 AC 3 ms
7,092 KB
testcase_05 AC 2 ms
7,168 KB
testcase_06 AC 3 ms
7,128 KB
testcase_07 AC 3 ms
7,132 KB
testcase_08 AC 2 ms
7,288 KB
testcase_09 AC 2 ms
7,072 KB
testcase_10 AC 2 ms
7,368 KB
testcase_11 AC 2 ms
7,136 KB
testcase_12 AC 2 ms
7,156 KB
testcase_13 AC 2 ms
7,156 KB
testcase_14 AC 3 ms
7,120 KB
testcase_15 AC 2 ms
7,164 KB
testcase_16 AC 2 ms
7,216 KB
testcase_17 AC 2 ms
7,152 KB
testcase_18 AC 2 ms
7,192 KB
testcase_19 AC 3 ms
7,160 KB
testcase_20 AC 2 ms
7,292 KB
testcase_21 AC 3 ms
7,224 KB
testcase_22 AC 152 ms
57,500 KB
testcase_23 AC 42 ms
22,248 KB
testcase_24 AC 93 ms
37,592 KB
testcase_25 AC 13 ms
12,680 KB
testcase_26 AC 53 ms
28,288 KB
testcase_27 AC 32 ms
19,416 KB
testcase_28 AC 42 ms
23,696 KB
testcase_29 AC 22 ms
14,392 KB
testcase_30 AC 142 ms
51,344 KB
testcase_31 AC 62 ms
31,448 KB
testcase_32 MLE -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

-- 剰余演算の分配則より (Wiki調べ)
-- ab mod n = ((a mod n) (b mod n)) mod n

factMod 0 = 1
factMod x = factMod (x - 1) * x `mod` (10^9 + 7)

myMod a n = a `mod` n

main = do
    str <- getLine
    let x = read str :: Integer
    print $ myMod (factMod x) (10^9 + 7)
0