結果

問題 No.129 お年玉(2)
ユーザー aimy
提出日時 2017-04-21 00:56:42
言語 Haskell
(9.10.1)
結果
MLE  
実行時間 -
コード長 295 bytes
コンパイル時間 9,722 ms
コンパイル使用メモリ 174,976 KB
実行使用メモリ 821,888 KB
最終ジャッジ日時 2024-07-20 01:08:39
合計ジャッジ時間 20,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 MLE * 1 -- * 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 (\x y -> mod (x+y) q)) [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