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
这题的IO例子纯坑爹! 例子里面输出百分位是四舍五入的,我一开始没注意,后来很高兴的注意到了,把它四舍五入了,然后就怎么都WA了。
最后试着把 +0.005 去掉,竟然AC了
AC代码:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
double a[][];
int main()
{
while(cin>>a[][])
{
cin>>a[][]>>a[][];
int i,j;
for(i=;i<=;i++)
for(j=;j<=;j++)
cin>>a[i][j];
double max[]={,,};
string cc[];
for(i=;i<=;i++)
{
int temp;
for(j=;j<=;j++)
{
if(a[i][j]>max[i])
{
max[i]=a[i][j];
temp=j;
}
}
if(temp==)
{
cc[i]="W";
}
if(temp==) cc[i]="T";
if(temp==) cc[i]="L";
}
for(i=;i<=;i++)
cout<<cc[i]<<" ";
double sum=1.0;
for(i=;i<=;i++)
sum=sum*max[i];
sum=sum*0.65;
sum=(sum-)*;
cout<<fixed<<setprecision()<<sum<<endl;
}
return ;
}
1011. World Cup Betting (20)(最大值)的更多相关文章
- 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 ov ...
- 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 ...
- PATA 1011 World Cup Betting (20)
1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...
- 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 ...
- 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 ...
- PAT Advanced 1011 World Cup Betting (20 分)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
随机推荐
- 杂乱无章之Oracle(一)
1. 设置共享池大小 SQL>ALTER SYSTEM SET SHARED_POOL_SIZE=32M; 2. 数据库高速缓冲区(database buffer cache):SQL ...
- SQL 生成一个日期范围
有时想按日或月生成一个序列,就像2014-1-1.2014-1-2.2014-1-3... 在sql server中可以写个函数来实现. /* 生成一个日期范围,如2014.01.2014.02... ...
- gitlab备份与恢复操作方法
github私有仓库是收费的,有些代码不方便托管到外面的git仓库,因此就产生了自己搭建git服务器的需求. 好在有广大的开源人士的贡献,有了gitlab这一神器. 手动配置较多,直接用集成包: bi ...
- Write a beautiful button
.btn-warning { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,0.25); background-color: #faa732; backg ...
- linux cd
cd -回到上一次 操作的目录 cd ..回到上级目录 cd ../../回到上两级目录
- linux配置LAMP
VPS注意:最近在VPS安装过程中,MYSQL老是报错 dpkg: error processing package mysql-server-5.6 (--configure): subproces ...
- 关于Hadoop集群的搭建环境变量相关配置
在任何路径下输入HDFS中的命令都可以进行shell操作的配置: 要设置环境变量: (1) # vim /etc/profile在profile文件下面追加写入下面信息 export HADOOP_H ...
- Bootstrap之导航栏(2015年-05年-20日)
<nav class="navbar navbar-default" style="border-color: transparent;">< ...
- GD库使用小结---2
接着上一篇.GD库可以折腾很多用法出来,当然得跟画图相关,除了前面的验证码.水印外,还可以进行图片的缩放,裁剪.旋转等操作,这在很多应用中可以见到. 1. 加水印 前面已经知道,我们可以使用image ...
- CentOS6.3系统安装SCP命令
原文:http://www.111cn.net/sys/CentOS/58387.htm CP使用SSH协议在Linux系统中进行文件传输,但我最小安装的CentOS 6.3没有该命令. 代码如下 ...