結果

問題 No.40 多項式の割り算
ユーザー gigurururu
提出日時 2015-04-10 22:57:46
言語 Haskell
(9.10.1)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 276 bytes
コンパイル時間 8,891 ms
コンパイル使用メモリ 173,440 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2024-07-04 13:36:32
合計ジャッジ時間 2,939 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
main = do
  ans <- map show . g . foldr f [0,0,0] . map read . drop 1 . words <$> getContents
  print $ (length ans) - 1
  putStrLn $ unwords $ ans
  where
    f i [a,b,c] = [i,a+c,b]
    g [a,0,0] = [a]
    g [a,b,0] = [a,b]
    g [a,b,c] = [a,b,c]
0