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 ...
随机推荐
- 有关ftp4j的FTPListParseException异常
昨天换了个ftp服务器,发现程序出现了异常it.sauronsoftware.ftp4j.FTPListParseException,网上搜了下,说是FTPClient.list()时it.sauro ...
- javaweb学习总结十六(tomcat服务器的使用、虚拟目录的映射)
一:tomcat服务器的目录 1:目录结构 2:web应用程序介绍 二:虚拟目录的映射 假如我在E盘建立一个目录web,里面存放1.html文件,我想让外界访问 1:直接在conf目录下的server ...
- oracle中的sql%rowcount
sql%rowcount用于记录修改的条数,就如你在sqlplus下执行delete from之后提示已删除xx行一样,这个参数必须要在一个修改语句和commit之间放置,否则你就得不到正确的修改行数 ...
- 【WebKit】---WebKit的CSS扩展(WebKit是私有属性)
1.-webkit-touch-callout 当你触摸并按住触摸目标时候,禁止或显示系统默认菜单.在iOS上,当你触摸并按住触摸的目标,比如一个链接,Safari浏览器将显示链接有关的系统默认菜单. ...
- Access数据库一种树形结构的实现和子节点查询
BOOL CManageDataBase::GetDepTreeAllSons( int rootItem ) { CADORecordset Rst(&m_DataBase); BOOL b ...
- STL--string(转载)
string类的构造函数: string(const char *s); //用c字符串s初始化 string(int n,char c); //用n个字符c初始化 此外,string类还支持默认构造 ...
- DB2 connection
1.DB2 connection-----DB2连接方式 2.开放应用层----type way 4 ==共享 3.本地本地之间访问----type way 2 JDBC SD---sysplex d ...
- lex&yacc4
yacc: we cannt use the $$ value dirictly. we need get it irrotly;
- 选择问题(选出第i个最小元素)
通过分治法解决的分析(还有其他方法解决选择问题如使用 堆) 1 同快速排序一样,对输入的数组进行递归分解 不同的是:快速排序会递归处理分解的两边,而选择问题只处理需要的一边 2 选择问题的期望时间代价 ...
- .NET清楚Cookies
foreach (string cookiename in Request.Cookies.AllKeys) { HttpCookie cookies = Request.Cookies[cookie ...