#P1042. [NOIP 2003 普及组] 乒乓球
[NOIP 2003 普及组] 乒乓球
Description
Huahua analyzes the match in the following way: first, list the outcome of each rally, then compute the match results under the -point system and the -point system (up to the end of the record).
For example, consider the following record (where means Huahua scores a point, and means Huahua’s opponent scores a point):
Under the -point system, Huahua wins game by to , wins game by to , and game is in progress with the current score to . Under the -point system, Huahua wins game by to , and game is in progress with the score to . If a game has just started, the score is to . A game ends only when the point difference is greater than or equal to .
Note: Once a game ends, the next one starts immediately.
Your program should read a sequence of match information in the form of and output the correct results.
Input Format
The input consists of several lines, each being a string of uppercase , , and . The character indicates the end of the match information; the program should ignore everything after .
Output Format
The output has two parts. Each part contains several lines, and each line corresponds to the score of one game (in the order implied by the input record). The first part is the result under the -point system, and the second part is the result under the -point system. The two parts are separated by one blank line.
WWWWWWWWWWWWWWWWWWWW
WWLWE
11:0
11:0
1:1
21:0
2:1
Hint
- Each line contains at most letters, and there are at most lines.
【Admin Note】
This is a very early problem, and there are two issues in the test points. These are kept as-is on Luogu:
- One test point actually contains lines.
- One test point includes characters other than , , and , which do not conform to the input format. However, those characters only appear after , and per the statement, all content after should be ignored.
【Problem Source】
NOIP 2003 Junior, Problem 1.
Translated by ChatGPT 5
京公网安备 11011102002149号