結果
| 問題 |
No.476 正しくない平均
|
| ユーザー |
alpha_virginis
|
| 提出日時 | 2017-02-13 23:44:17 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 646 bytes |
| コンパイル時間 | 6,871 ms |
| コンパイル使用メモリ | 181,052 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-29 19:12:25 |
| 合計ジャッジ時間 | 4,868 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
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
ソースコード
{-# LANGUAGE OverloadedStrings #-}
import Data.Maybe
import qualified Data.ByteString.Char8 as C
import Control.Monad(forM_)
import Data.Int
yes :: C.ByteString
yes = "YES"
no :: C.ByteString
no = "NO"
getInts :: IO [Int]
getInts = do
ss <- C.getLine
return $ map (fst . fromJust . C.readInt) $ C.words ss
-- end template --
main :: IO ()
main = do
xs <- getInts
ys <- getInts
let ss = solve xs ys
C.putStrLn ss
solve :: [Int] -> [Int] -> C.ByteString
solve [n,a] xs = if sum xs' == n' * a' then yes else no
where
xs' :: [Int64]
xs' = map toEnum xs
n' :: Int64
n' = toEnum n
a' :: Int64
a' = toEnum a
alpha_virginis