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

题目意思:这其实是一道英文阅读题,中国体育彩票提供的一种“三赢”游戏,对于每一场比赛的三种结果赢、平局、输都有三个赔率,三场比赛作为游戏的一组,选择每一场比赛的一个赔率,那么最后所得到的利润将会是三场比赛赔率乘积的65%,再减去两块钱一次的彩票钱。

解题思路:想要获得最大的利润,找每一场赔率最高的,三场最高的分别是a、b、c,最后的计算公式就是(a*b*c*0.65-1)*2。

三个数一组,在每一组中找到最大的那一个数,保存起来,同时使用ans累乘该最大值,最后套用公式计算即可。

odd

英 [ɒd] 美 [ɑd]

adj. 奇数的;古怪的;剩余的;临时的;零散的

n. 奇数;怪人;奇特的事物

odds

英 [ɒdz] 美 [ɑdz]

n. 几率;胜算;不平等;差别

#include<cstdio>
#include<cstring>
#include<algorithm>
#define inf 0x7fffffff
using namespace std;
int main()
{
int i,j,t,a[];
double d[],maxs;
char c[]="WTL";
double ans=1.0;
for(i=;i<;i++)
{
maxs=0.0;
for(j=;j<;j++)
{
scanf("%lf",&d[j]);
if(d[j]>maxs)
{
maxs=d[j];
t=j;
}
}
ans*=maxs;
a[i]=t;
}
for(i=;i<;i++)
{
printf("%c ",c[a[i]]);
}
ans=(ans*0.65-)*;
printf("%.2lf\n",ans);
return ;
}

PAT 1011 World Cup Betting 查找元素的更多相关文章

  1. PAT 1011 World Cup Betting

    1011 World Cup Betting (20 分)   With the 2010 FIFA World Cup running, football fans the world over w ...

  2. pat 1011 World Cup Betting(20 分)

    1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...

  3. PAT 1011 World Cup Betting (20分) 比较大小难度级别

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

  4. 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 ...

  5. 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 ...

  6. PAT 甲级 1011 World Cup Betting (20)(代码+思路)

    1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...

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

  8. 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 ...

  9. 1011 World Cup Betting (20 分)

    1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over wer ...

随机推荐

  1. 判断浏览器是否启用cookie

    <!DOCTYPE html> <html> <body onload="checkCookies()"> <script> fun ...

  2. Python之如何修改运行的快捷键

    如果你在Pycharm中运行程序使用Ctrl+shift+F10快捷键,运行失败,使用Pycharm工具组,右键一下选择“Run+文件名称AAA”运行程序,直接运行成功的话,那么你就可以 更换自己的运 ...

  3. Redux-DevTools安装

    去谷歌应用商店搜索Redux-DevTools,安装就行 高级使用方法:访问https://github.com/zalmoxisus/redux-devtools-extension import ...

  4. 用js写九九乘法表格,附带背景颜色

    <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8 ...

  5. .NET Core 3终结点不能映射控制器

    今天在学.net core的时候发现了一个问题,终结点死活映射不了自己添加的控制器,后经过研究发现解决方法,可能这个问题不应该叫做问题,可是我是初学者,就把这个问题给拎出来.本人开发环境 VS2019 ...

  6. 在项目中在线使用Iconfont图标

    Iconfont真的很强大,图标数量惊人,基本任意的关键词都能搜索到你想要的结果.而且是国产的,网速会比较快,还可以改变图标颜色. 它提供svg.png.ai三种格式下载,之前我一直都是乖乖的一个个下 ...

  7. idea2019注册码,亲测可用!

    2019已经过半了,最近可把我忙死了,好久没打理这里的留言了. 今天登上来,看到许多同学反馈按照之前的那篇文章 IntelliJ IDEA 2018激活码 永久破解 里的步骤无法破解idea,其实用这 ...

  8. Electron中使用sql.js操作SQLite数据库

    推荐sql.js——一款纯js的sqlite工具. 一.关于sql.js sql.js(https://github.com/kripken/sql.js)通过使用Emscripten编译SQLite ...

  9. linux学习第一周

    1. 按系列罗列Linux的发行版,并描述不同发行版之间的联系与区别 2. 安装Centos7.6操作系统,创建一个自己名字的用户名,并可以正常登录,将主要步骤截图. 3. 配置环境变量,实现执行hi ...

  10. Appium(九):Appium API(三) 滑动和拖拽、高级手势、手机操作

    1. 滑动和拖拽 我们在做自动化测试的时候,有些按钮是需要滑动几次屏幕后才会出现,此时,我们需要使用代码来模拟手指的滑动,也就是接下来要学的滑动和拖拽了. 1.1 swipe滑动事件 从一个坐标位置滑 ...