21723_TENNIS

2022-5-16 18:20| 发布者: Hocassian| 查看: 28| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505792847500-Problem List-采集的数据-后羿采集器.html

Pro.ID

21723

Title

TENNIS

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21723

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1500/500 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Do you follow tennis? If so, you will be aware of the strange scoring system, 15, 30, 40, game. Then, of course there is 40-40 or deuce, with one player having to get 2 points ahead to win a game.
    This problem asks you to work out the score of a tennis match given the player who wins each point. To keep things simple, players are called A and B. The points are given as a sequence of letters, where A means a point won by player A, B a point won by player B. Here is an example:
    ABAABBAABABAABABBB
    Remember, to win a game a player needs to score 4 points, but also to be 2 points ahead. So in the above example, the first game is represented by ABAABBAA and player A has won it. It went to deuce then player A won two points. The second game was represented by BABAABABBB. This game was won by player B. Again it went to deuce, player A went ahead by 1 but player B caught up. Player B then won the last 2 points. After all that, the score would be 1 game all.

    输入

    Input will consist of a number of strings of characters, each on a line of its own. No line will contain more than 250 characters. The last line will contain just the # character ? this line should not be processed.
    Each line represents part of a tennis match, a number of completed games. The line will contain only the upper case letters A and B representing points won by each player. Consider each line as separate, and work out the score, in games, after the points shown.

    输出

    Description
    Do you follow tennis? If so, you will be aware of the strange scoring system, 15, 30, 40, game. Then, of course there is 40-40 or deuce, with one player having to get 2 points ahead to win a game.
    This problem asks you to work out the score of a tennis match given the player who wins each point. To keep things simple, players are called A and B. The points are given as a sequence of letters, where A means a point won by player A, B a point won by player B. Here is an example:
    ABAABBAABABAABABBB
    Remember, to win a game a player needs to score 4 points, but also to be 2 points ahead. So in the above example, the first game is represented by ABAABBAA and player A has won it. It went to deuce then player A won two points. The second game was represented by BABAABABBB. This game was won by player B. Again it went to deuce, player A went ahead by 1 but player B caught up. Player B then won the last 2 points. After all that, the score would be 1 game all.
    Input
    Input will consist of a number of strings of characters, each on a line of its own. No line will contain more than 250 characters. The last line will contain just the # character ? this line should not be processed.
    Each line represents part of a tennis match, a number of completed games. The line will contain only the upper case letters A and B representing points won by each player. Consider each line as separate, and work out the score, in games, after the points shown.
    Output
    Output will be one line for each input line in the form of a score, A x B y where x is the number of games won by A, y is the number of games won by B.
    Sample Input
    ABAABBAABABAABABBB
    AABAABABAAAABBAAABABBAB
    #
    Sample Output
    A 1 B 1
    A 3 B 1
    Source

    样例输入

    ABAABBAABABAABABBB
    AABAABABAAAABBAAABABBAB
    #

    样例输出

    A 1 B 1
    A 3 B 1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部