結果
| 問題 | No.441 和か積 | 
| コンテスト | |
| ユーザー |  情報学生 | 
| 提出日時 | 2019-08-25 20:45:16 | 
| 言語 | Haskell (9.10.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 763 bytes | 
| コンパイル時間 | 2,156 ms | 
| コンパイル使用メモリ | 181,024 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 00:11:39 | 
| 合計ジャッジ時間 | 3,202 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
コンパイルメッセージ
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
ソースコード
import Data.Char (isSpace)
import Control.Applicative ((<$>))
import Data.List (unfoldr)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
getL :: (ByteString -> [Integer]) -> IO [Integer]
getL f = f <$> B.getLine
readIL :: (ByteString -> Maybe (Integer, ByteString)) -> (ByteString -> [Integer])
readIL f = unfoldr g
    where
        g s = do
            (n, s') <- f s
            return (n, B.dropWhile isSpace s')
main :: IO ()
main = do
    [a, b] <- getL (readIL B.readInteger)
    if a == b && a == 0
        then putStrLn "E"
        else if a == b && a == 2
            then putStrLn "E"
            else if a == 0 || b == 0 || a == 1 || b == 1
                then putStrLn "S"
                else putStrLn "P"
            
            
            
        