PAT-1011 World Cup Betting 解答(with python)

1.Description:

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.

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%.

2.Example:

3.solutions:

 1 """
 2     created by sheepcore on 2020-03-01
 3 """
 4 
 5 def maxOdd(game):
 6     g1 = eval(game[0])
 7     g2 = eval(game[1])
 8     g3 = eval(game[2])
 9     if g1 >= g2 and g1 >= g3:
10         return "W", g1
11     if g2 >= g1 and g2 >= g3:
12         return "T", g2
13     if g3 >= g1 and g3 >= g2:
14         return "L", g3
15 
16 if __name__ == "__main__":
17     game1 = input().split()
18     game2 = input().split()
19     game3 = input().split()
20     
21     s1, odd1 = maxOdd(game1)
22     s2, odd2 = maxOdd(game2)
23     s3, odd3 = maxOdd(game3)
24     odd = (odd1 * odd2 * odd3 * 0.65 - 1) * 2
25     print(s1 + " " + s2 + " " + s3 + " ", end="")
26     print("%.2f" %odd)

 

posted @ 2020-03-01 19:57  SheepCore  阅读(184)  评论(0编辑  收藏  举报