結果

問題 No.406 鴨等間隔の法則
ユーザー Haar
提出日時 2016-08-31 19:46:25
言語 Haskell
(9.10.1)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 2,106 ms
コンパイル使用メモリ 175,232 KB
実行使用メモリ 44,800 KB
最終ジャッジ日時 2024-07-07 11:41:52
合計ジャッジ時間 8,354 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:10:1: warning: [GHC-94817] [-Wtabs]
    Tab character found here, and in 9 further locations.
    Suggested fix: Please use spaces instead.
   |
10 |            func (x:y:xs) = (y-x):(func(y:xs))
   | ^^^^^^^^
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative
import Data.List

main :: IO()
main = do
     getLine
     x <- sort . map (read::String->Int) . words <$> getLine
     putStrLn $ check $ func x
     where
	   func (x:y:xs) = (y-x):(func(y:xs))
	   func (x:[]) = []
	   check (x:y:xs)
	   	 | x == 0 = "NO"
		 | x == y = check (y:xs)
		 | otherwise = "NO"
	   check (x:[]) = "YES"
0