PAT甲级——1011 World Cup Betting
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
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double sum=1,m,temp=0.0;
int t=0;
char a[3]={'W','T','L'};
for(int j=0;j<3;j++)
{
temp=0.0;
for(int i=0;i<3;i++)
{
scanf("%lf",&m);
if(temp<m)
{
temp = m;
t=i;
}
}
sum = temp*sum;
cout<<a[t]<<" ";
}
printf("%0.2f",(sum*0.65-1.0)*2.0);
return 0;
}
PAT甲级——1011 World Cup Betting的更多相关文章
- 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)(20 分)(水题,不用特别在乎精度)
1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...
- PAT 甲级 1011 World Cup Betting
https://pintia.cn/problem-sets/994805342720868352/problems/994805504927186944 With the 2010 FIFA Wor ...
- 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 Advanced 1011 World Cup Betting (20 分)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
- PAT甲级——A1011 World Cup Betting
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 分) 凌宸1642
PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...
- PAT 1011 World Cup Betting
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over w ...
随机推荐
- POJ - 3665 iCow(模拟)
题意:有N首歌曲,播放的顺序按照一定的规则,输出前T首被播放的歌的编号.规则如下: 1.每首歌有一个初始的等级r,每次都会播放当前所有歌曲中r最大的那首歌(若r最大的有多首,则播放编号最小的那首歌). ...
- js 动态添加元素 删除元素逻辑
js 动态添加元素 删除元素逻辑 var obox=document.getElementById("box"); oadd.onclick=function(){ var odi ...
- JavaScript之基于原型链的继承
本文介绍下js的OOP中的继承. 上图的要点为:Foo函数在创建时会自动生成内置属性prototype,而typeof Foo.prototype是object类型的. 上图的要点为:Foo.prot ...
- request对象和response对象的作用和相关方法
response对象(响应) 响应行 状态码 :setStatus(int a) 设置状态码 302重定向 304控制缓存 响应头 setHeader() 一个key对应一个value addHead ...
- 使用plantuml插件
安装 https://github.com/jvantuyl/sublime_diagram_plugin 安装依赖 brew install graphviz 把sublime_diagram_pl ...
- sys.path.append()加入当前目录为环境变量
当我们导入一个模块时:import xxx,默认情况下python解析器会搜索当前目录.已安装的内置模块和第三方模块,搜索路径存放在sys模块的path中: >>> import ...
- echart曲线图标识最大值、最小值、平均值
option = { xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAx ...
- Hexo博客NexT主题美化之评论系统
前言 更多效果展示,请访问我的博客 https://kangmingxian.github.io/ 效果图: image Valine 诞生于2017年8月7日,是一款基于Leancloud的快速 ...
- 申请FreeDomain,透过DNS转回自己的Godaddy Cpanel
148.66.136.216这个IP,是我的Cpanel IP. 过了几分钟,这个kkchan.tk就转到Cpanel了. 然后在Cpanel的Addon Domains加上kkchan.tk,那就可 ...
- 前端Json 增加,删除,修改元素(包含json数组处理)
一:基础JSON对象 二:JSON数组数据 以下为增删修改方法: <!DOCTYPE html> <html lang="en"> <head> ...