結果

問題 No.129 お年玉(2)
ユーザー okadukiokaduki
提出日時 2015-01-17 00:19:05
言語 Haskell
(9.10.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 4,662 ms
コンパイル使用メモリ 174,976 KB
実行使用メモリ 15,232 KB
最終ジャッジ日時 2024-11-27 23:00:44
合計ジャッジ時間 6,576 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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

ソースコード

diff #

import Control.Applicative
import Text.Printf

main = do
  n <- (read :: String -> Integer) <$> getLine
  m <- (read :: String -> Integer) <$> getLine
  print $ choose m (n `div` 1000 * 1000 `mod` (m*1000) `div` 1000)

choose n k = (f n k `div` f k k) `mod` 1000000000 
  where
    f n k = foldr (*) 1 [n-k+1..n]
  
0