PATA 1011 World Cup Betting (20)
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.0 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.0*2.5*65%-1)*2 = 37.98 yuans (accurate up to 2 decimal places).
Input
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
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.0 1.6
4.1 1.2 1.1
Sample Output
T T W 37.98
#include <cstdio>
#include <algorithm>
using namespace std;
double win[4],tie[4],lose[4];
double maxodd[4];
double maxofthree(double x,double y,double z)
{
if(x>=z&&x>=y)
return x;
else if(y>=x&&y>=z)
return y;
else if(z>=x&&z>=y)
return z;
}
int main()
{
for(int i = 1;i <= 3; i++)
{
scanf("%lf%lf%lf",&win[i],&tie[i],&lose[i]);
maxodd[i] = maxofthree(win[i],tie[i],lose[i]); }
for(int i = 1;i <= 3; i++){
if(win[i] >= tie[i] && win[i] >= lose[i]) {
printf("W ");
}
else if(tie[i] >= win[i]&&tie[i] >= lose[i])
{
printf("T ");
}
else if(lose[i] >= win[i]&&lose[i] >= tie[i])
{
printf("L ");
}
}
double ans = (maxodd[1]*maxodd[2]*maxodd[3]*0.65-1)*2;
printf("%.2lf",ans);
return 0;
}
PATA 1011 World Cup Betting (20)的更多相关文章
- PAT 甲级 1011 World Cup Betting (20)(20 分)
1011 World Cup Betting (20)(20 分)提问 With the 2010 FIFA World Cup running, football fans the world ov ...
- PAT 甲级 1011 World Cup Betting (20)(代码+思路)
1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...
- PAT甲 1011. World Cup Betting (20) 2016-09-09 23:06 18人阅读 评论(0) 收藏
1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...
- PAT 甲级 1011 World Cup Betting (20)(20 分)(水题,不用特别在乎精度)
1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...
- 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 ...
- 1011 World Cup Betting (20)(20 point(s))
problem With the 2010 FIFA World Cup running, football fans the world over were becoming increasingl ...
- 1011. World Cup Betting (20)(最大值)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
- PAT Advanced 1011 World Cup Betting (20 分)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
- PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) (找最值)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
随机推荐
- 用WPF实现打印及打印预览
原文:用WPF实现打印及打印预览 应该说,WPF极大地简化了我们的打印输出工作,想过去使用VC++做开发的时候,打印及预览可是一件极麻烦的事情,而现在我不会再使用C++来做Windows的桌面应用了- ...
- MQTT是IBM开发的一个即时通讯协议,构建于TCP/IP协议上,是物联网IoT的订阅协议,借助消息推送功能,可以更好地实现远程控制
最近一直做物联网方面的开发,以下内容关于使用MQTT过程中遇到问题的记录以及需要掌握的机制原理,主要讲解理论. 背景 MQTT是IBM开发的一个即时通讯协议.MQTT构建于TCP/IP协议上,面向M2 ...
- 读BeautifulSoup官方文档之与bs有关的对象和属性(3)
上一节说到.string的条件很苛刻, 如果某个tag里面包含了超过一个children, 就会返回None, 但是这里提供另外一种方式 .strings, 它返回的是一个generator, 比如对 ...
- Java FTP 基本操作
最近工作中用到了 FTP 相关的操作,所以借此机会了解了下具体内容. FTP基础 关于 FTP 基础推荐阅读<使用 Socket 通信实现 FTP 客户端程序>,其中需要特别注意的是主动模 ...
- mingw64 构建 Geos
简述 在做某个小程序时候用到了QT,而用的Qt是mingw版本的,所以使用mingw构建了一下geos库. 1.准备工作 首先需要先安装好mingw,这里直接使用http://www.mingw-w6 ...
- xcode缓存清理
移除对旧设备的支持 影响:可重新生成:再连接旧设备调试时,会重新自动生成. 路径: ~/Library/Developer/Xcode/iOS DeviceSupport 如果你不是在wb145230 ...
- background-blend-mode叠加代码
<html> <head> <style> .container { background: url("p1.jpg"), url(" ...
- js通过沿着作用域链还是原型链查找变量
这是一道非常典型的JS闭包问题,结果和具体的解析请看这里. 对于其中的`函数作用域链的问题`博主似乎没有解释清楚,有一些疑问:js中的变量到底是沿着作用域链还是原型链查找呢? 首先,要分清作用域链与原 ...
- ORACLE 错误 ora-01830 解决方法
http://www.cnblogs.com/BetterWF/archive/2012/06/20/2556442.html 错误产生原因:date类型不能包含秒以后的精度. 如日期:2012-06 ...
- ORA-23421: job number 225 is not a job in the job queue
在对数据库进行异机恢复之后,为了防止上面作业自动执行,扰乱正常业务系统,需要将测试库上的作业和db_link进行删除:但是使用sys用户连接进去,删除的时候报如下错误SQL> exec DBMS ...