結果
| 問題 |
No.293 4>7の世界
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-17 22:10:23 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 867 bytes |
| コンパイル時間 | 9,278 ms |
| コンパイル使用メモリ | 171,136 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 11:59:56 |
| 合計ジャッジ時間 | 10,900 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
コンパイルメッセージ
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:4:1: warning: [GHC-94817] [-Wtabs]
Tab character found here, and in 29 further locations.
Suggested fix: Please use spaces instead.
|
4 | (FourSeven x) == (FourSeven y) = x == y
| ^^^^^^^^
[2 of 2] Linking a.out
ソースコード
newtype FourSeven = FourSeven Integer instance Eq FourSeven where (FourSeven x) == (FourSeven y) = x == y instance Ord FourSeven where (FourSeven x) `compare` (FourSeven y) | x == y = EQ | length x' > length y' = GT | length x' < length y' = LT | otherwise = foldl (****) EQ (zipWith cmp x' y') where x' = numToList x; y' = numToList y; (****) :: Ordering -> Ordering -> Ordering (****) GT _ = GT (****) LT _ = LT (****) EQ x = x cmp :: Integer -> Integer -> Ordering cmp x y | x == y = EQ | (x /= 4 && x /= 7) || (y /= 4 && y /= 7) = x `compare` y | x == 4 && y == 7 = GT | x == 7 && y == 4 = LT | otherwise = EQ numToList :: Integer -> [Integer] numToList 0 = [] numToList n = numToList (n `div` 10) ++ [(n `mod` 10)] main = do [a, b] <- getLine >>= return . map read . words print $ if FourSeven a < FourSeven b then b else a