結果

問題 No.129 お年玉(2)
ユーザー aimy
提出日時 2017-04-21 00:33:18
言語 Haskell
(9.10.1)
結果
MLE  
実行時間 -
コード長 277 bytes
コンパイル時間 10,477 ms
コンパイル使用メモリ 176,768 KB
実行使用メモリ 820,000 KB
最終ジャッジ日時 2024-07-20 01:08:02
合計ジャッジ時間 21,951 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 MLE * 2 -- * 42
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

q = 10^9

comb n r = iterate (scanl1 (+)) [1,1..] !! (n'-r') !! r'
 where [n',r'] = map fromIntegral [n,r]

main = getContents >>= print . otoshidama . map read . words

otoshidama :: [Integer] -> Integer
otoshidama [n,m] = let r = mod n (1000*m) in mod (comb m (div r 1000)) q
0