zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    线程+IO流
    jiava trim()
    statement 的延伸 ----》PreparedStatement
    java中math的用法
    java中获取所有文件--(递归调用)
    编写一个JAVA类,用于计算两个日期之间的周数。
    java中数组排序.知识点
    javascript 常用功能总结
    jquery
    创建 HTML内容
  • 原文地址:https://www.cnblogs.com/sheepcore/p/12391610.html
Copyright © 2011-2022 走看看