顽强的小白

1011 World Cup Betting (20 分)

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:
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).

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 2.5 1.7
1.2 3.1 1.6
4.1 1.2 1.1

Sample Output:

T T W 39.31

题目解析

题目老长了,但是实际的要求却很简单,给出三场比赛,一行就是一场,第一列是胜利,第二列是平局,第三列是败局,这些数据我也没看懂是啥意思,应该是算钱的一个倍数,咱们要做的就是输出每一行的最大的结果,输出W T L(这就是那一列的标号),然后把这些最大值按照题目所给公式处理输出结果就行了。

代码实现

这些比较每一行的最大值在输入的时候就可以进行比较出来了

 double bet[3][3];double maxh=0,maxj=0,total=1;for(int i=0;i<3;++i){   //行maxh=0;for(int j=0;j<3;++j){  //列scanf("%lf",&bet[i][j]);if(maxh<bet[i][j]){  //比较大小maxh=bet[i][j];maxj=j;}}if(maxj==0)printf("W "); //输出每一行最大数的情况else if(maxj==1)printf("T ");else printf("L ");total*=maxh;} total=total*0.65-1;total=total*2;printf("%.2lf",total);
} 

PAT日志 1011相关推荐

  1. PAT甲级1011 World Cup Betting:[C++题解]模拟

    文章目录 题目分析 题目来源 题目分析 来源:acwing 分析:每场取最大的数. ac代码 #include<bits/stdc++.h> using namespace std;int ...

  2. PAT 甲级 1011 World Cup Betting

    PAT 甲级 1011 World Cup Betting With the 2010 FIFA World Cup running, football fans the world over wer ...

  3. pat 乙级 1011 A+B 和 C(C++)

    题目 给定区间 [−2​31​​ ,2​31​​ ] 内的 3 个整数 A.B 和 C,请判断 A+B 是否大于 C. 输入格式: 输入第 1 行给出正整数 T (≤10),是测试用例的个数.随后给出 ...

  4. PAT Basic 1011

    1011 A+B 和 C (15 分) 给定区间 [−2​31​​,2​31​​] 内的 3 个整数 A.B 和 C,请判断 A+B 是否大于 C. 输入格式: 输入第 1 行给出正整数 T (≤10 ...

  5. PAT日志 1035

    顽强的小白 1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords ...

  6. PAT(乙级)1011 A+B 和 C (15 分)

    1011 A+B 和 C (15 分) 这个题也比较水,发上来凑个数吧,这两天太忙也没有更新. #include<stdio.h> int main() {int i,n;double a ...

  7. [PAT乙级]1011 A+B 和 C

    给定区间 [−2​31​​,2​31​​] 内的 3 个整数 A.B 和 C,请判断 A+B 是否大于 C. 输入格式: 输入第 1 行给出正整数 T (≤10),是测试用例的个数.随后给出 T 组测 ...

  8. Pat乙级1011题:A+B和C

    题目:给定区间[-2的31次方, 2的31次方]内的3个整数A.B和C,请判断A+B是否大于C. 我写的代码: del abc(self,a,b,c,i):if a+b>c: print(&qu ...

  9. PAT乙级1011.A+B和C (15)(15 分)

    给定区间[-2^31^, 2^31^]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给 ...

最新文章

  1. TNS-12518 Linux Error:32:Broken pipe
  2. iwconfig的用法
  3. 打用户断点_如何快速测出线缆断点 ?一文了解清楚
  4. ssh html项目,SSH项目-学生管理系统
  5. 哈工大三本计算机考研,纯干货【普通三本逆袭哈工大】—城市规划考研必胜经验...
  6. Linux-(C/C++)动态链接库生成以及使用(libxxx.so)
  7. python 调用不存在的方法 统一处理_提取不重复数据在Excel、SQL与Python中的处理方法...
  8. Python——类与对象的学习笔记
  9. 标记重复值删除重复值
  10. CSDN免费快速获得积分和直接获取下载码的几个办法
  11. OD点击寄存器变色OD
  12. 怎么看计算机的硬盘容量,查看电脑硬盘内存空间怎么操作,独家教程到,电脑硬盘内存空间如何操作查看...
  13. SpringBoot数据访问CannotGetJdbcConnectionException: Failed to obtain JDBC Connection异常的解决方式。
  14. 免费常用IP归属地查询API
  15. 导入Model为啥没有addAttribute()方法???
  16. 火爆的AI绘画+红包封面+春联+节日头像+创作者入驻小程序源码
  17. 企业降低包装成本的13种简单方法(下篇)
  18. HDU 3687 National Day Parade
  19. 客户端与服务器端通信方式总结
  20. 根据阿里GeoJSON格式生成全国Shp矢量边界

热门文章

  1. C++进阶——内存管理(三)
  2. 80C51的8位数码管显示
  3. 真果科技董事长贾求真女士应邀出席2019APEC女性领导力论坛
  4. 马云称经济今明两年最严峻
  5. 深度学习中的模型修剪
  6. 计算机秋招国企总结,亲身经历风险
  7. Fluent应用技巧-自定义材料
  8. 送外卖真的能够做到月入过万吗?
  9. 苹果cms怎么批量替换无法播放的资源地址
  10. echarts 多条折线图