結果
問題 | No.632 穴埋め門松列 |
ユーザー | kuwa |
提出日時 | 2018-01-19 23:38:48 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 1,082 bytes |
コンパイル時間 | 2,627 ms |
コンパイル使用メモリ | 162,468 KB |
実行使用メモリ | 7,380 KB |
最終ジャッジ日時 | 2023-08-26 00:34:39 |
合計ジャッジ時間 | 3,394 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,380 KB |
testcase_01 | AC | 3 ms
7,348 KB |
testcase_02 | AC | 3 ms
7,272 KB |
testcase_03 | AC | 3 ms
7,348 KB |
testcase_04 | AC | 2 ms
7,296 KB |
testcase_05 | AC | 2 ms
7,316 KB |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
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"