結果

問題 No.35 タイパー高橋
ユーザー d_nishiyama85d_nishiyama85
提出日時 2015-06-13 12:38:26
言語 Haskell
(9.8.2)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 605 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 166,132 KB
実行使用メモリ 16,192 KB
最終ジャッジ日時 2023-09-20 21:15:50
合計ジャッジ時間 1,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
13,540 KB
testcase_01 AC 22 ms
13,760 KB
testcase_02 AC 22 ms
16,192 KB
testcase_03 AC 32 ms
16,168 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.Monad
import Control.Applicative
import Text.Printf

main :: IO()
main = do
  n <- readLn :: IO Int
  input <- replicateM n $ words <$> getLine
  let tmp = map numChars input
  let typed = map (\ (i, j) -> i) tmp
  let missed = map (\ (i, j) -> j) tmp
  printf "%d %d\n" (sum(typed) :: Int) (sum(missed) :: Int)


numChars :: [String] -> (Int, Int)
numChars args =
  let lim = 12 * t `div` 1000
  in
   case lim > length(s) of
     True -> (length(s), 0)
     False -> (lim, length(s) - lim)
   where
     t = readInt $ args !! 0
     s = args !! 1


readInt :: String -> Int
readInt = read
0