[BOJ 13216] Badminton
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
1
Time limit:
1.0s
Memory limit:
64M
Problem types
Allowed languages
Anisa (Player A) and Ben (Player B) are playing a singles badminton match. Here are the basic badminton rules:</p>
- To win a match, a player needs to win 2 out of 3 games.
- The first player to reach 21 points wins the game. (A different rule applies when the players are tied 20-20. You may assume this case does not happen.)
- Either player can score a point no matter who serves.
- After a game is won, a new game begins and the score resets to 0-0.
A sequence of A’s and B’s that records which player scored for each serve.
출력 형식
The score and who wins the match (A or B).
예제 입력 1
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
예제 출력 1
21-0
21-0
A
예제 입력 2
BBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBB
예제 출력 2
0-21
21-0
0-21
B
예제 입력 3
ABBBBAABABBAABABAABBBAABBBAABBBAAAAAAAABBBAABAAABBBBBBAABBBBBAABBBBAAABBAAABBBBAAAABBAABBBABBAABBABBBABAABAABAAA
예제 출력 3
21-18
12-21
21-19
A
Comments