1011 World Cup Betting

With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting fans were putting their money where their mouths were, by laying all manner of World Cup bets.(随着2010年世界杯的举行,全世界的足球迷们越来越兴奋,因为最好的球队中的最好的球员正在南非争夺世界杯奖杯。同样,足球博彩球迷通过各种世界杯投注,将钱放在嘴边。)

Chinese Football Lottery provided a “Triple Winning” game. The rule of winning was simple: first select any three of the games. Then for each selected game, bet on one of the three possible results – namely W for win, T for tie, and L for lose. There was an odd assigned to each result. The winner’s odd would be the product of the three odds times 65%.(中国足球彩票提供了"三赢"游戏。获胜的规则很简单:首先选择任何三个游戏。然后,对于每场选定的比赛,投注三种可能的结果之一 ,即赢、平和输。每个结果都有一个奇数分配。获胜者的奇数将是三个赔率的 65% 的产物。)

For example, 3 games’ odds are given as the following:

W T L
1.1 2.5 1.7
1.2 3.1 1.6
4.1 1.2 1.1
To obtain the maximum profit, one must buy W for the 3rd game, T for the 2nd game, and T for the 1st game. If each bet takes 2 yuans, then the maximum profit would be (4.1×3.1×2.5×65%−1)×2=39.31 yuans (accurate up to 2 decimal places).(为了获得最大的利润,必须购买第三场比赛,第二场比赛,和第一场比赛。如果每个赌注需要2元,那么最大的利润将是(4.1×3.1×2.5×65%+1)×2=39。31元(精确到2位小数)。)

Input Specification:
Each input file contains one test case. Each case contains the betting information of 3 games. Each game occupies a line with three distinct odds corresponding to W, T and L.(每个输入文件包含一个测试用例。每个案例都包含 3 场比赛的投注信息。每场比赛占据一条线,其赔率与 和 相对应有三个不同的赔率。)

Output Specification:
For each test case, print in one line the best bet of each game, and the maximum profit accurate up to 2 decimal places. The characters and the number must be separated by one space.(对于每个测试用例,在一行中打印每个游戏的最佳匹配,最大利润精确到 2 位小数。字符和数字必须用一个空格分隔。)

Sample Input:
1.1 2.5 1.7
1.2 3.1 1.6
4.1 1.2 1.1
Sample Output:
T T W 39.31

思路:

每行取最大值,然后按照给的公式输出即可

res = 1
wtl = ['W','T','L']
out =[]
for i in range(3):
    list1 = list(map(float,input().split()))
    out.extend(wtl[list1.index(max(list1))])
    res *= max(list1)
    
res = (res*0.65-1)*2
print(' '.join(out),round(res,2))

1011 World Cup Betting

上一篇:由学习《软件设计重构》所想到的代码review(二)


下一篇:PAT 甲级 1011 World Cup Betting 模拟