結果
問題 | No.146 試験監督(1) |
ユーザー | Michae'Gon |
提出日時 | 2015-04-18 04:23:34 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 675 ms / 1,000 ms |
コード長 | 260 bytes |
コンパイル時間 | 2,019 ms |
コンパイル使用メモリ | 176,128 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-07-04 16:12:11 |
合計ジャッジ時間 | 5,728 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 675 ms
8,320 KB |
testcase_01 | AC | 673 ms
8,320 KB |
testcase_02 | AC | 674 ms
8,192 KB |
コンパイルメッセージ
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:1: warning: [GHC-94817] [-Wtabs] Tab character found here, and in two further locations. Suggested fix: Please use spaces instead. | 5 | where | ^^^^^^^^ Main.hs:6:24: warning: [GHC-63394] [-Wx-partial] In the use of ‘head’ (imported from Prelude, but defined in GHC.List): "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty." | 6 | calc x = (div (head $ reads x) 2 + mod (head $ reads x) 2) * (last $ reads x) | ^^^^ Main.hs:6:49: warning: [GHC-63394] [-Wx-partial] In the use of ‘head’ (imported from Prelude, but defined in GHC.List): "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty." | 6 | calc x = (div (head $ reads x) 2 + mod (head $ reads x) 2) * (last $ reads x) | ^^^^ [2 of 2] Linking a.out
ソースコード
main = getLine >> getContents >>= print . (`mod` 1000000007) . solve . lines solve :: [String] -> Integer solve = foldl (\acc x -> calc x + acc) 0 where calc x = (div (head $ reads x) 2 + mod (head $ reads x) 2) * (last $ reads x) reads = map read . words