結果
問題 | No.360 増加門松列 |
ユーザー |
|
提出日時 | 2016-04-17 22:54:44 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 558 bytes |
コンパイル時間 | 2,091 ms |
コンパイル使用メモリ | 174,848 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-12-24 04:30:29 |
合計ジャッジ時間 | 3,014 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
コンパイルメッセージ
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:5:1: warning: [GHC-94817] [-Wtabs] Tab character found here, and in 9 further locations. Suggested fix: Please use spaces instead. | 5 | where max = maximum [a,b,c]; | ^^^^^^^^ [2 of 2] Linking a.out
ソースコード
import Data.List isKadomatsu :: Integer -> Integer -> Integer -> Bool isKadomatsu a b c = (a /= b && b /= c && a /= c) && (b == max || b == min) where max = maximum [a,b,c]; min = minimum [a,b,c]; isIncreasedKadomatsu :: [Integer] -> Bool isIncreasedKadomatsu (a:b:[]) = True isIncreasedKadomatsu (a:b:c:xs) = if a < c && isKadomatsu a b c then isIncreasedKadomatsu (b:c:xs) else False main = do seq <- getLine >>= return . permutations . map (read::String->Integer) . words putStrLn $ if or (map isIncreasedKadomatsu seq) then "YES" else "NO"