No.35 Typer Takahashi
タグ : / 解いたユーザー数 733
作問者 :
LayCurse
Problem Statement
Takahashi believes that typing skill is essential for fast programming.
So he will train his typing skill with a typing game.
For simplicity, in this problem we consider only strings consisting of lowercase letters as the strings to be typed.
In a certain typing game, \(1\) game is divided into \(N\) sections, and in section \(k\), the string \(S_k\) must be typed within \(T_k\) milliseconds.
Takahashi can correctly type up to \(12\) characters per \(1\) second.
This means that he can type up to \(12\) characters in \(1000\) milliseconds and up to \(11\) characters in \(999\) milliseconds; in \(m\) milliseconds, he can type up to \(\lfloor 12m/1000 \rfloor\) characters. (\(\lfloor x \rfloor\) denotes the largest integer not exceeding \(x\).)
Assuming that Takahashi types as many characters as possible, write a program that finds, over the entire \(1\) game, the number of characters he can type correctly and the number of characters he fails to type and misses.
Input
\(N\) \(T_1\ S_1\) \(T_2\ S_2\) \(\vdots\) \(T_N\ S_N\)
Line \(1\) contains an integer \(N \ (1 \leq N \leq 1000)\), the number of sections in \(1\) game.
Each of the next \(N\) lines contains, in order, an integer \(T_k\ (1 \leq T_k \leq 30000)\) representing the time limit for section \(k\) and the string \(S_k\) to be typed, separated by a single-byte space.
\(S_k\) is a string consisting only of lowercase letters, and its length is at least \(1\) and at most \(100\).
Output
Output, on \(1\) line, the number of characters Takahashi can type correctly and the number of characters he fails to type and misses, separated by a single-byte space.
Print a newline at the end of the output.
Sample
Sample 1
Input
2 750 yukicoder 749 yukicoder
Output
17 1
The time Takahashi needs to type \(9\) characters is \(750\) milliseconds.
In section \(1\) he can type everything, but in section \(2\) he is slightly short of time and misses \(1\) character.
Sample 2
Input
4 83 topcoder 417 atcoder 29183 yukicoder 1 codeforces
Output
14 20
In section \(3\), there is idle time after he finishes typing yukicoder, but the leftover time cannot be carried over to other sections.
Bonus: http://www.sightseekerstudio.com/typingmania/contents/odyssey.html
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。