結果

問題 No.369 足し間違い
ユーザー ducktailducktail
提出日時 2018-01-13 21:58:36
言語 Haskell
(9.6.2)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 1,100 ms
コンパイル使用メモリ 164,408 KB
実行使用メモリ 9,108 KB
最終ジャッジ日時 2023-08-25 16:01:34
合計ジャッジ時間 1,911 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,692 KB
testcase_01 AC 2 ms
7,564 KB
testcase_02 AC 2 ms
7,608 KB
testcase_03 AC 2 ms
7,796 KB
testcase_04 AC 4 ms
8,860 KB
testcase_05 AC 3 ms
7,932 KB
testcase_06 AC 4 ms
8,824 KB
testcase_07 AC 4 ms
9,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative ((<$>), (<*>))
import Data.List

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

main :: IO ()
main = do
  B.getLine
  solve <$> readIntList <*> readLn >>= print

solve :: [Int] -> Int -> Int
solve as v = sum as - v

readIntList :: IO [Int]
readIntList = unfoldr f <$> B.getLine
  where
    f s = do
      (n, s') <- B.readInt s
      return (n, B.dropWhile isSpace s')
0