結果
| 問題 |
No.40 多項式の割り算
|
| コンテスト | |
| ユーザー |
kou_kkk
|
| 提出日時 | 2025-07-17 01:13:26 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 5,000 ms |
| コード長 | 482 bytes |
| コンパイル時間 | 11,172 ms |
| コンパイル使用メモリ | 187,048 KB |
| 実行使用メモリ | 14,080 KB |
| 最終ジャッジ日時 | 2025-07-17 01:13:39 |
| 合計ジャッジ時間 | 7,926 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
module Main where main :: IO () main = do _ <- getLine a <- getIntList mapM_ putStrLn $ solve a solve :: [Int] -> [String] solve a = fmt . dropWhile (==0) . loop $ reverse a loop xs@[x, y, z] = xs loop (x:y:z:xs) = loop (y:z+x:xs) loop xs = xs fmt :: [Int] -> [String] fmt [] = ["0", "0"] fmt ns = map ($ ns) [f1, f2] where f1 = show . pred . length f2 = unwords . reverse . map show getIntList :: IO [Int] getIntList = map read . words <$> getLine
kou_kkk