結果

問題 No.500 階乗電卓
ユーザー Leonardone
提出日時 2017-04-08 00:03:31
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 5,095 ms
コンパイル使用メモリ 171,776 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 03:28:18
合計ジャッジ時間 4,913 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

-- Try yukicoder
-- author: Leonardone @ NEETSDKASU

main = putStrLn . solve . read =<< getLine

solve x
    | x > 49   = replicate 12 '0' -- 因数に2と5が両方12個以上あると下12桁はずっと0
    | otherwise = show $ kaijo 1 x
        where
            kaijo a 0 = a
            kaijo a k = kaijo (a * k `mod` 10 ^ 12) (k - 1)
0