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 ...
随机推荐
- 使用xtrabackup实现MySQL主从复制
环境描写叙述 主从环境 项目 Master Slave OS版本号 SuSE 11sp1 x86_64 SuSE 11sp1 x86_64 MySQL版本号 官方版本号5.5.37 官方版本号5.5. ...
- 分类算法SVM(支持向量机)
支持向量机(Support Vector Machine ,SVM)的主要思想是:建立一个最优决策超平面,使得该平面两侧距离该平面最近的两类样本之间的距离最大化,从而对分类问题提供良好的泛化能力.对于 ...
- 使用Wireshark抓取SNMP Trap包
Wireshark SNMP Trap 过滤关键字:snmp && udp.dstport == 162
- C#更改控制台文本的前景色和背景色
关键字:C# NET 控制台 前景色 背景色地址:http://www.cnblogs.com/txw1958/archive/2012/12/07/csharp-console-color.html ...
- cocos2d-x 源代码分析 : Ref (CCObject) 源代码分析 cocos2d-x内存管理策略
从源代码版本号3.x.转载请注明 cocos2d-x 总的文件夹的源代码分析: http://blog.csdn.net/u011225840/article/details/31743129 1.R ...
- MVC 用基架创建Controller,通过数据库初始化器生成并播种数据库
1 创建MVC应用程序 2 在Model里面创建实体类 using System; using System.Collections.Generic; using System.Linq; using ...
- 如何清除XP的网络共享密码
一.利用NET命令 我们知道在Windows XP中提供了“net user”命令,该命令可以添加.修改用户账户信息,其语法格式为: net user [UserName [Password | *] ...
- ASP POST请求
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- WPF小笔记-Popup拖动
查看了下MSDN发现Popup没有类拟Drag相关的属性和方法,第一时间想了thumb.忙了一会未果,就想起了强大的google. 发现中文资料很少,英文的发现有两篇很不错的,所以笔记在博客园里,希望 ...
- Codejock.Xtreme.Toolkit.Pro.v15.3.1 下载 与 VS2015补丁使用方法
Codejock.Xtreme.Toolkit.Pro.v15.3.1 下载 与 VS2015补丁使用方法 打算放在CSDN进行下载的,上传完成后发现资源分设置的1分,本打算赚点下载分的.在页面上没有 ...