結果

問題 No.35 タイパー高橋
コンテスト
ユーザー d_nishiyama85
提出日時 2015-06-13 12:38:26
言語 Haskell
(9.14.1)
コンパイル:
ghc -rtsopts -with-rtsopts=-K1G -o a.out -O2 _filename_
実行:
./a.out
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 605 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,342 ms
コンパイル使用メモリ 198,800 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2026-03-28 05:58:53
合計ジャッジ時間 1,900 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #
raw source code

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