21402_BeanCounting

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

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

Pro.ID

21402

Title

Bean Counting

Title链接

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

AC

1

Submit

4

Ratio

25.00%

时间&空间限制

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

    The CSC has decided to hold a contest to guess the number of beans in a given jar. To make it a wee bit more interesting, they decided to have the contestants guess the number of a particular kind of bean, the jar having many types of beans in it. Each participant would par $2.00 per guess.

    If the guess is one off (either one greater or less) than the actual count, they get a single share of the total pot. If the guess is right on, they get two shares of the total pot.

    Your task is to tally these guesses and print out how much each person wins.

    输入

    The first line will contain hundreds of letters, from a - z, each representing one bean of that type of bean. There will only be 26 different types of beans.  Each of the n following line will be the guess from a contestant. A contestant can guess as many times as they like. The line will begin with a single letter, in the range A - Z, leaving only 26 possible contests. The first letter will be followed by a single space, and then up to five pairs of letter/number combinations, the letter representing the type of bean for this guess, and the number the number of that bean the contestant expects to find. The letter and the value of a guess will be separated by a ':' and each guess on lines with more than one guess will be separated by a ','.

    Tallying:

    The amount a contestant will receive is based on shares of a pot. The pot will consist of the total of all the guesses, at $2.00 per guess. The fraction each person gets will be based on:

    TotNum: total number of guesses by all contestants.

    TotShares: total number of shares from all contestants.

    OffOne: number of off-by-one guesses by that contestant.

    RightOn: number of right-on guesses by that contestant.

    ((TotNum * $2.00) / TotShares) * (OffOne + (RightOn * 2))

    输出

    Description

    The CSC has decided to hold a contest to guess the number of beans in a given jar. To make it a wee bit more interesting, they decided to have the contestants guess the number of a particular kind of bean, the jar having many types of beans in it. Each participant would par $2.00 per guess.

    If the guess is one off (either one greater or less) than the actual count, they get a single share of the total pot. If the guess is right on, they get two shares of the total pot.

    Your task is to tally these guesses and print out how much each person wins.

    Input

    The first line will contain hundreds of letters, from a - z, each representing one bean of that type of bean. There will only be 26 different types of beans.  Each of the n following line will be the guess from a contestant. A contestant can guess as many times as they like. The line will begin with a single letter, in the range A - Z, leaving only 26 possible contests. The first letter will be followed by a single space, and then up to five pairs of letter/number combinations, the letter representing the type of bean for this guess, and the number the number of that bean the contestant expects to find. The letter and the value of a guess will be separated by a ':' and each guess on lines with more than one guess will be separated by a ','.

    Tallying:

    The amount a contestant will receive is based on shares of a pot. The pot will consist of the total of all the guesses, at $2.00 per guess. The fraction each person gets will be based on:

    TotNum: total number of guesses by all contestants.

    TotShares: total number of shares from all contestants.

    OffOne: number of off-by-one guesses by that contestant.

    RightOn: number of right-on guesses by that contestant.

    ((TotNum * $2.00) / TotShares) * (OffOne + (RightOn * 2))

    Output

    Print out all the winners, in alphabetical order, and their winnings, separated by a single space. Each winner should be on a line by itself.

    Sample Input

    aadddddddddddddddddddddddffffffffffffffffwwwwwwwwwwwwccccalalala
    A a:6,c:6
    B w:12
    C d:25
    D d:22,c:4,l:3,f:15

    Sample Output

    A 3.20
    B 3.20
    D 9.60

    Source

    样例输入

    aadddddddddddddddddddddddffffffffffffffffwwwwwwwwwwwwccccalalala
    A a:6,c:6
    B w:12
    C d:25
    D d:22,c:4,l:3,f:15

    样例输出

    A 3.20
    B 3.20
    D 9.60

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部