結果
問題 | No.129 お年玉(2) |
ユーザー |
|
提出日時 | 2018-09-07 14:12:57 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 9,117 ms |
コンパイル使用メモリ | 171,520 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2024-11-28 01:10:39 |
合計ジャッジ時間 | 10,315 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
コンパイルメッセージ
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
ソースコード
importControl.ApplicativeimportData.Listmain::IO()main = solve <$> readLn <*> readLn >>= printsolve::Integer->Integer->Integersolve n m = comb m (n `mod` (m * 1000) `div` 1000)comb::Integer->Integer->Integercomb n m| n < m = 0| m == 0 = 1| n < 2 * m = comb n (n - m)| otherwise = flip mod d $ foldl' f 1 $ zip [n-m+1 .. n] [1 .. m]wheref c (x, y) = c * x `div` yd = 10 ^ 9