結果
| 問題 |
No.632 穴埋め門松列
|
| コンテスト | |
| ユーザー |
kuwa
|
| 提出日時 | 2018-01-19 23:38:48 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,082 bytes |
| コンパイル時間 | 535 ms |
| コンパイル使用メモリ | 157,824 KB |
| 最終ジャッジ日時 | 2024-12-24 12:53:33 |
| 合計ジャッジ時間 | 952 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:37:24: error: [GHC-87543]
Ambiguous occurrence ‘BC.getLine’.
It could refer to
either ‘BC.getLine’,
imported qualified from ‘Data.ByteString’ at Main.hs:8:1-38,
or ‘BC.getLine’,
imported qualified from ‘Data.ByteString.Char8’ at Main.hs:7:1-44.
|
37 | readInt = parseInt <$> BC.getLine
| ^^^^^^^^^^
Main.hs:40:26: error: [GHC-87543]
Ambiguous occurrence ‘BC.getLine’.
It could refer to
either ‘BC.getLine’,
imported qualified from ‘Data.ByteString’ at Main.hs:8:1-38,
or ‘BC.getLine’,
imported qualified from ‘Data.ByteString.Char8’ at Main.hs:7:1-44.
|
40 | readInts = parseInts <$> BC.getLine
| ^^^^^^^^^^
ソースコード
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC
------------------------------------------
isKadomatsu :: Int -> Int -> Int -> Bool
isKadomatsu a b c = (a < b && b > c) || (a > b && b < c)
main :: IO ()
main = do
q <- words <$> getLine
let [a1, b1, c1] = map (\x -> if x == "?" then 1 else read x) q
[a2, b2, c2] = map (\x -> if x == "?" then 4 else read x) q
r1 = if isKadomatsu a1 b1 c1 then "1" else ""
r2 = if isKadomatsu a2 b2 c2 then "4" else ""
putStrLn $ r1 ++ r2
------------------------------------------
{- Int input -}
parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt
parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words
readInt :: IO Int
readInt = parseInt <$> BC.getLine
readInts :: IO [Int]
readInts = parseInts <$> BC.getLine
{- Double Formatting -}
doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"
kuwa