結果
問題 |
No.197 手品
|
ユーザー |
|
提出日時 | 2016-09-01 07:19:28 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 696 bytes |
コンパイル時間 | 1,984 ms |
コンパイル使用メモリ | 171,136 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 13:34:19 |
合計ジャッジ時間 | 3,353 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 WA * 2 |
コンパイルメッセージ
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:6:1: warning: [GHC-94817] [-Wtabs] Tab character found here, and in 40 further locations. Suggested fix: Please use spaces instead. | 6 | bef <- sum . zipWith (*) (iterate (*2) 1) . map convert <$> getLine | ^^^^^^^^ [2 of 2] Linking a.out
ソースコード
import Control.Applicative import Data.Bits main :: IO() main = do bef <- sum . zipWith (*) (iterate (*2) 1) . map convert <$> getLine n <- readLn aft <-sum . zipWith (*) (iterate (*2) 1) . map convert <$> getLine let nb = popCount bef let na = popCount aft putStrLn $ if nb /= na then "SUCCESS" else if bef == 0 || bef == 7 then "FAILURE" else case n of 0 -> if bef == aft then "Failure" else "Success" 1 | isLat bef && (bef == aft || isCen aft) -> "FAILURE" | isCen bef && isLat aft -> "FAILURE" | otherwise -> "SUCCESS" _ -> "FAILURE" isLat x = elem x [1,3,4,6] isCen x = elem x [2,5] convert :: Char -> Int convert x | x == 'o' = 0 | x == 'x' = 1