結果
問題 |
No.420 mod2漸化式
|
ユーザー |
|
提出日時 | 2018-08-19 14:05:07 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 409 bytes |
コンパイル時間 | 6,107 ms |
コンパイル使用メモリ | 172,928 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 04:49:15 |
合計ジャッジ時間 | 3,335 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
コンパイルメッセージ
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 Control.Applicative import Data.List main :: IO () main = solve <$> readLn >>= putStrLn solve :: Int -> String solve x | x > 31 = "0 0" | otherwise = unwords . map show $ [comb 31 x, comb 30 (x-1) * 2147483647] comb :: Int -> Int -> Int comb n m | m == 0 = 1 | n > 2 * m = comb n (n-m) | otherwise = foldl' f 1 $ zip [n-m+1 .. n] [1 .. m] where f a (i,j) = a * i `div` j