結果

問題 No.1131 Deviation Score
ユーザー ducktail
提出日時 2024-05-05 20:09:06
言語 Haskell
(9.10.1)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 10,449 ms
コンパイル使用メモリ 180,912 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-11-27 20:59:00
合計ジャッジ時間 12,284 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = do
  n <- readLn
  solve n <$> f >>= mapM_ print
  where
    f = readil B.readInt <$> B.getLine

solve :: Int -> [Int] -> [Int]
solve n xs = map f xs
  where
    f x = ((100 + x) * n - sm) `div` (2 * n)
    sm = sum xs

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr $ f . B.dropWhile isSpace
0