結果
| 問題 |
No.502 階乗を計算するだけ
|
| コンテスト | |
| ユーザー |
かりあげクン
|
| 提出日時 | 2020-09-07 17:35:17 |
| 言語 | Haskell (9.10.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 345 bytes |
| コンパイル時間 | 6,905 ms |
| コンパイル使用メモリ | 176,000 KB |
| 実行使用メモリ | 12,928 KB |
| 最終ジャッジ日時 | 2024-11-29 11:11:57 |
| 合計ジャッジ時間 | 26,864 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 42 TLE * 10 |
コンパイルメッセージ
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
ソースコード
import Data.List (foldl') import Data.Bool (bool) main :: IO () main = do n <- readLn :: IO Integer print $ bool 0 (facMod 1000000007 n) (n < 1000000007) facMod :: Integer -> Integer -> Integer facMod n x = foldl' (prodMod n) 1 [1..x] prodMod :: Integer -> Integer -> Integer -> Integer prodMod n x y = ((x `mod` n) * (y `mod` n)) `mod` n
かりあげクン