• 【PAT (Advanced Level) Practice】1011 World Cup Betting (20 分)python题解


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

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

    1. W T L
    2. 1.1 2.5 1.7
    3. 1.2 3.1 1.6
    4. 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).

    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 WT and L.

    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.

    Sample Input:

    1. 1.1 2.5 1.7
    2. 1.2 3.1 1.6
    3. 4.1 1.2 1.1

    Sample Output:

    T T W 39.31
    1. list1 = list(input().split())
    2. list2 = list(input().split())
    3. list3 = list(input().split())
    4. a = max(list1)
    5. b = max(list2)
    6. c = max(list3)
    7. a1 = list1.index(a)
    8. b1 = list2.index(b)
    9. c1 = list3.index(c)
    10. WTL = ['W','T','L']
    11. print('%s %s %s %.2f' % (WTL[a1],WTL[b1],WTL[c1],(float(a)*float(b)*float(c)*0.65-1)*2))

     

  • 相关阅读:
    Django 入门学习总结5
    java计算机毕业设计客户关系智能管理系统源码+mysql数据库+系统+lw文档+部署
    思科交换机65系列配置
    JDK自带JVM分析工具
    [AI]ChatGPT4 与 ChatGPT3.5 区别有多大
    (2022版)一套教程搞定k8s安装到实战 | Service
    使用DiskGenius拓展系统盘C盘的容量
    MobaXtem通过SSH远程登录ubuntu系统
    【网管日记】linux服务器上apt-get换源
    关于专利技术交底书分类的真相
  • 原文地址:https://blog.csdn.net/xu_haiao/article/details/126504625