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 ...
随机推荐
- python性能分析——insert()
我们在list中插入数据时,经常使用这两个函数: append():在列表的末尾增加一个数据 insert():在某个特定位置前加一个数据 Python内的list实现是通过数组实现的,而不是链表的形 ...
- 2018.4.24 java实现8皇后算法
import java.util.Scanner; public class Nqueens { private boolean verify(int[] arr,int i) { // TODO A ...
- Blender Tutorial - Earth curves [Animation nodes]笔记
https://www.youtube.com/watch?v=jEYI4lnOprY&t= Blender Tutorial - Earth curves [Animation nodes] ...
- (17)模型层 -ORM之msql 单表的增、删、改、查 及其他操作
单表操作-增.删.改.查 ret=models.User.objects.filter(id=1) #这里的结果是一个queryset对象 ret=modles.User.Objects.filte ...
- (4)MySQL的外键(不同表之间的数据关联)
问题:下列这张表中部门等列名下输入的数据没有约束,那么可以随便填写符合规则的数据但是不符合实际需求的值,这样就造成了不符合规则的数据在表中存在,外键就是为了解决这个问题,管理员可以在另一张表中设置好符 ...
- 转:《Javascript模块化编程》
(一):模块的写法 转载至:http://www.ruanyifeng.com/blog/2012/10/javascript_module.html (二):AMD规范 转载至:http://www ...
- hive array、map、struct使用
hive提供了复合数据类型:Structs: structs内部的数据可以通过DOT(.)来存取,例如,表中一列c的类型为STRUCT{a INT; b INT},我们可以通过c.a来访问域aMaps ...
- 人教版高中数学(A版)
必修1 (已看) 第一章 集合与函数概念 1.1 集合 1.2 函数及其表示 1.3 函数的基本性质 第二章 基本初等函数(1) 2.1 指数函数 2.2 对数函数 2.3 幂函数 第三章 函数的应用 ...
- Fundamentals of Computer Graphics 中文版(第二版) (Peter Shirley 著)
1 引言 2 数学知识 3 光栅算法 4 信号处理 5 线性代数 6 矩阵变换 7 观察 8 隐藏面消除 9 表面明暗处理 10 光线追踪 11 纹理映射 12 完整的图形流水线 13 图形学的数据结 ...
- powerdesigner16.5 破解
powerdesigner16.5 破解 方法: 破解方法 1.将下载下来的PowerDesigner165_破解文件.rar进行解压,之后找到pdflm16.dll破解文件,并将pdflm16.dl ...