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 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
#include<iostream>
#include<iomanip> using namespace std; int main()
{
double profit[][] = { }, max[] = { };
int index[] = { };
char result[] = {'W','T','L'}; for(int i=;i<;++i)
{
for(int j=;j<;++j)
{
cin>>profit[i][j]; if(profit[i][j] > max[i])
{
index[i] = j;
max[i] = profit[i][j];
}
}
} cout<<setprecision();
cout.setf(ios::fixed,ios::floatfield); cout<<result[index[]]<<" "<<result[index[]]<<" "<<result[index[]]<<" "
<< setprecision() << (max[]*max[]*max[]*0.65-)* << endl; return ;
}
PAT 甲级 1011 World Cup Betting (20)(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 over ...
- PAT甲级——1011 World Cup Betting
PATA1011 World Cup Betting With the 2010 FIFA World Cup running, football fans the world over were b ...
- PAT 甲级 1011 World Cup Betting
https://pintia.cn/problem-sets/994805342720868352/problems/994805504927186944 With the 2010 FIFA Wor ...
- pat 1011 World Cup Betting(20 分)
1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...
- 1011 World Cup Betting (20 分)
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over wer ...
- 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 ...
随机推荐
- django-models层
----https://www.cnblogs.com/liuqingzheng/articles/9472723.html 一.ORM简介 查询数据层次图解:如果操作mysql,ORM是在pymys ...
- hdu5173 How Many Maos Does the Guanxi Worth
#include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f ]; ]; ][]; void dijkstra(i ...
- controller层,service层,dao层(main函数,子函数,子的子函数)
controller层相当于main函数————————————————————————————————————————————————————@RequestMapping("/query ...
- CentOS7.1 KVM虚拟化之环境准备
备注:实验没有问题,只是暂时还不知道弄这个用来干嘛,不过先留着以后查看吧 一.基础平台 1.一台装有VMware的Windows系统 (可联网) 2.CentOS7.1 64bit 镜像 二.最小化安 ...
- MySQL InnoDB Engine--缓冲器数据交换
通常情况下,缓冲池无法将整个数据库所有数据都进行缓冲,而且不同数据的访问频率不一样,有些数据会被频繁访问,而有些数据可能数月不会被访问一次,因此数据库使用最近最少使用LRU latest Recent ...
- Djangon 基础总结 汇总 从请求到返回页面的过程,
第一步我是用户 现在 浏览器上输入地址 ---> 发送给服务 来请求返回当前的页面 第二步 服务端获得我当前的客户端要求访问的地址 第三步 服务端去urls.py中去,来看是要访问那个 ...
- Hasura GraphQL 内部表结构
Hasura 使用pg 数据库存储引擎的元数据信息,在hdb_catalog schema 下面,是在初始化的时候生成的 对于表的管理.权限的信息存储都在这个schema下 hdb_table 这个表 ...
- 项目构建之maven篇:5.仓库及nexus创建私服-2
下载安装 下载地址 改动默认端口: home\conf\nexus.properties # Sonatype Nexus # ============== # This is the most ba ...
- Javascript高级调试——console.table()
原文:http://www.mariusschulz.com/2013/11/13/advanced-javascript-debugging-with-consoletable 本文只是简单翻译,部 ...
- Office 2010 打开文件后所有的格式成了时间的解决方法
最新不知道什么原因,每一个 Excel 文件打开后,时需的数据都成了时间格式. 而且改都改不了,改了后第二次打开又成了这个样子. 最后找到解决方法. 如下动画,将 [$F400] 数据格式删除就可以. ...