結果
| 問題 | No.420 mod2漸化式 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-08 00:05:39 |
| 言語 | Haskell (9.14.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 1,000 ms |
| + 258µs | |
| コード長 | 327 bytes |
| 記録 | |
| コンパイル時間 | 8,791 ms |
| コンパイル使用メモリ | 198,528 KB |
| 実行使用メモリ | 9,756 KB |
| 最終ジャッジ日時 | 2026-08-23 08:58:02 |
| 合計ジャッジ時間 | 11,176 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
main :: IO ()
main = do
x <- readLn :: IO Integer
putStrLn $ show (nCr 31 x) ++ " " ++ show ((nCr 30 (x - 1)) * (2 ^ 31 - 1))
nCr :: Integer -> Integer -> Integer
nCr n r
| r < 0 = 0
| r > n = 0
| otherwise = div (fact n) ((fact (n - r)) * (fact r))
where
fact :: Integer -> Integer
fact n = product [1..n]