码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 【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 W, T 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))

     

  • 相关阅读:
    Effective C++ 改善程序与设计的55个具体做法笔记与心得 3
    Linux C基础(9)
    JavaScript--day02学习(简单数据类型/复杂数据类型)
    Google Summer of Code谷歌编程之夏活动流程全解析(上)
    NSAT-8000电源自动测试系统,测试速度快测量准确
    Android官方ShapeableImageView描边/圆形/圆角图,xml布局实现
    Java八股文系列之六(Spring)
    JavaWeb-MyBatis(下)
    Pytorch中Conv2d和ConvTranspose2d参数计算公式
    潮玩宇宙大逃杀游戏开发源码说明
  • 原文地址:https://blog.csdn.net/xu_haiao/article/details/126504625
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号