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. linus 命令

    系统信息 arch 显示机器的处理器架构uname -m 显示机器的处理器架构uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) h ...

  2. 《Java基础知识》Java集合(Collection)

    作为一个Developer,Java集合类是我们在工作中运用最多的.最频繁的类.相比于数组(Array)来说,集合类的长度可变,更加适合于现代开发需求: Java集合就像一个容器,可以存储任何类型的数 ...

  3. Linux Bash文本操作之grep篇

    Linux grep命令用于查找文件里符合条件的字符串.是文本检索中常用的工具之一. grep  指令在文件中查找能够匹配指定模式字符串的行.如果没有指定文件名,或者文件名为  -  ,则从标准输入设 ...

  4. visualStudio 的一些常用使用操作总结

    今年苟了差不多一整年,期间断断续续把c++ prime plus 看完了 ,发现并没有什么鸟用 ,但是对代码怎么形成二进制的过程 动态内存管理 这些模模糊糊的确实理解更深刻些了 特别是c++过度到c# ...

  5. CentOS 7上的进程管理

    一些杂乱的基础概念 程序是一种静态的文件,躺在磁盘上.而进程则是将程序运行起来放置于内存中.因此进程就是运行中的程序,是程序运行起来的一个实例.同一个程序可以运行为多个进程/实例. 进程之间有父子关系 ...

  6. RF之简介

    robot framework 是一个通用型的自动测试框架 - 自动测试用例的实现方式 - 自动测试用例的开发支持 :  IDE.库 - 和用例管理系统的集成 - 测试执行:相关测试套件和测试用例的执 ...

  7. Python爬虫基础——正则表达式

    说到爬虫,不可避免的会牵涉到正则表达式. 因为你需要清晰地知道你需要爬取什么信息?它们有什么共同点?可以怎么去表示它们? 而这些,都需要我们熟悉正则表达,才能更好地去提取. 先简单复习一下各表达式所代 ...

  8. DUBBO: xml文件无法解析

    xml是: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http:/ ...

  9. Ajax简单应用之个人简历页面搭建

    1.搭建HTTP静态Web服务器. 代码实现: # 1.导入socket模块 import socket import threading # 创建服务器类 class HttpServerSocke ...

  10. C# .NET的BinaryFormatter、protobuf-net、Newtonsoft.Json以及自己写的序列化方法序列化效率和序列化后的文件体积大小对比

    测试结果如下图: 测试结果整理后: 结论: 1.这几个工具中,protobuf-net序列化和反序列化效率是最快的 2.BinaryFormatter和Newtonsoft.Json反序列化慢的比较多 ...