题目:

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

Sample Output:

T T W 39.31

题目分析:

水题

代码:

 1 #include<iostream>
 2 using namespace std;
 3 float x[3][3];
 4 float rate;
 5 int main(){
 6     rate=1.0;
 7     for(int i=0;i<3;i++){
 8         float m=0.0;
 9         int a=0;
10         for(int j=0;j<3;j++){
11             cin>>x[i][j];
12             if(x[i][j]>m){
13                 m=x[i][j];
14                 a=j;
15             }
16         }
17         rate*=m;
18         switch(a){
19             case 0:cout<<"W ";break;
20             case 1:cout<<"T ";break;
21             case 2:cout<<"L ";break;
22         }
23     }
24     printf("%.2lf",(rate*0.65-1)*2);
25     return 0;
26 } 

 

转载于:https://www.cnblogs.com/orangecyh/p/10287980.html

PTA-1011——World Cup Betting相关推荐

  1. 浙江大学PAT上机题解析之1011. World Cup Betting (20)

    1011. World Cup Betting (20) 时间限制  400 ms 内存限制  32000 kB 代码长度限制  16000 B 判题程序    Standard 作者    CHEN ...

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

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

  3. 1011. World Cup Betting (20)

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

  4. PAT 甲级 1011 World Cup Betting

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

  5. 【PAT甲级】 1011 World Cup Betting

    [PAT甲级] 1011 World Cup Betting 原题 With the 2010 FIFA World Cup running, football fans the world over ...

  6. PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...

  7. 1011 World Cup Betting (20 分)_14行代码AC

    立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 With the 2010 FIFA World Cup running, football fans the world ove ...

  8. PAT甲级真题 1011 World Cup Betting (20分) C++实现

    题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...

  9. (C++)1011 World Cup Betting

    笔记:我觉得这一次的代码很优雅 #include<cstdio> #include<cmath> #include<cstring> #include<alg ...

  10. 【PAT甲级 ArrayList存放class】1011 World Cup Betting (20 分) Java版 3/3通过 四舍五入保留两位小数

    题目 一共给9个数,3*3,找到每行最大,按照题目要求套算式,计算就行 坑 & 心得 没啥坑,一次通过,用到的知识点是:自定义排序.四舍五入保留两位小数 DecimalFormat df = ...

最新文章

  1. 深入学习JavaScript: apply call方法 详解(转)
  2. 大数据框架对比:Hadoop、Storm、Samza、Spark和Flink——flink支持SQL,待看
  3. 高可用集群中的选举机制
  4. (42)驱动中使用全局变量
  5. ABAP 中的变量和常量
  6. 您需要了解的有关默认方法的所有信息
  7. 加减法计算器-java
  8. 【java】spring-boot源码解析之应用启动
  9. 把握初期企业的发展战略规划
  10. 【vue开发问题-解决方法】(一)在style中设置background-image时路径问题
  11. 自考 《计算机网络原理04741》真题解析
  12. VS2013 ADO.NET 连接 SQLEXPRESS
  13. 通过代理服务器下载网页
  14. pixhawk通信机制
  15. 1688.item_get API接口
  16. java curl 使用方法_如何在Java中使用这个cURL POST请求?(Spotify API)
  17. uniapp按照官方《针对plus.runtime.install在安卓9.0+上无法执行的解决方案》处理后报错:安装包解析错误
  18. 皮肤美化润饰滤镜Imagenomic Portraiture 4.0.3 for PS/LR4032 WIN中文汉化版
  19. 二层交换、三层交换和路由的原理及区别
  20. 凯文·米特尼克 安全建议 十条经验

热门文章

  1. 计算机应用主要学PS,全国计算机一级Photoshop应用试题及答案
  2. android 耳机检测,android – 检测耳机是否有麦克风
  3. 进程间通信--IPC
  4. Android平台监听系统截屏方案预研及相关知识点
  5. PackageManagerService启动过程
  6. html如何引入less,VueJS如何引入css或者less文件的一些坑
  7. 安装Windows10,Ubuntu双系统14.04LTS记录
  8. Qt 并行计算圆周率示例
  9. 英特尔530和535哪个好_详细介绍2020版联想小新Air 14酷睿版和锐龙版怎么选,哪款好...
  10. 树莓派nginx无法安装mysql_树莓派上安装nginx