結果

問題 No.9001 標準入出力の練習問題(テスト用)
ユーザー mtwtkmanmtwtkman
提出日時 2023-05-09 21:28:48
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 256 bytes
コンパイル時間 6,136 ms
コンパイル使用メモリ 171,136 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-05-04 17:29:13
合計ジャッジ時間 6,646 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:45: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
  |
5 |    in x : if rest == "" then [] else split (tail rest)
  |                                             ^^^^
[2 of 2] Linking a.out

ソースコード

diff #

split :: String -> [String]
split [] = []
split xs =
  let (x, rest) = span (/= ' ') xs
   in x : if rest == "" then [] else split (tail rest)


main :: IO ()
main = do 
  v <- getLine
  let vs = map read (split v) :: [Int]
  putStr $ show $ sum vs
   
   
0