PAT 1011 World Cup Betting
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.1 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 ( yuans (accurate up to 2 decimal places).
Input Specification:
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 Specification:
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.1 1.6
4.1 1.2 1.1
Sample Output:
T T W 39.31
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- #define maxnum 100005
- double shuzu[][];
- int main(){
- for(int i=;i < ;i++){
- for(int j=;j < ;j++){
- cin >> shuzu[i][j];
- }
- }
- double sum = 1.0;
- for(int i=;i < ;i++){
- map<double,char> mp;
- mp[shuzu[i][]] = 'W';
- mp[shuzu[i][]] = 'T';
- mp[shuzu[i][]] = 'L';
- double t = max(shuzu[i][],max(shuzu[i][],shuzu[i][]));
- sum*=t;
- cout << mp[t] << " ";
- }
- sum = (sum*0.65-)*;
- printf("%.2lf",sum);
- return ;
- }
傻逼题写了半个小时,还是一开始没想明白就上手写了,结果写的时候一直再改。
还有要熟悉结构化编程,每次实现一个功能可以先试一下正确不正确。
PAT 1011 World Cup Betting的更多相关文章
- pat 1011 World Cup Betting(20 分)
1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...
- PAT 1011 World Cup Betting 查找元素
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
- PAT 1011 World Cup Betting (20分) 比较大小难度级别
题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...
- 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 ...
- 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)(代码+思路)
1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...
- 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 ...
- 1011 World Cup Betting (20 分)
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over wer ...
随机推荐
- 【前端开发工具】WijmoJS 2018 v3 正式发布,全面支持Angular7
WijmoJS(前端开发工具包)2018年度第三个大版本已经正式发布,本次更新除了全面支持Angular7之外,还允许用户使用Web Workers在前端更高效地导出PDF.智能的分组表头属性.全新的 ...
- python学习 day05打卡
今天可变学习的主要内容是 : 本节主要内容: 1.字典的简单介绍 2.字典增删改查和其他操作 3.字典的嵌套 一.字典的简单介绍 字典(dict)是pytho中唯一的一个映射类型.它是以{}括起来的键 ...
- Linux 命令之sed
简介 sed 是一种在线编辑器,它一次处理一行内容.在处理的时候,会先把当前处理的行存储在临时缓冲区,这被称之为 "末世空间", 然后再使用 sed 命令处理缓冲区的内容,处理完成 ...
- python 传递多个参数
def oper(a,*args): print(args) print(a) oper("q","s","d","z" ...
- VC.【转】窗口置于前台并激活的方法
1.VC 窗口置于前台并激活的方法 - CSDN博客.html https://blog.csdn.net/oXunFeng/article/details/52681279 2.(http://ww ...
- Altium Designer PCB的时候 高亮显示引脚连线
按住Ctrl ,左击连线,就可以高亮显示两个连接的引脚.
- QT信号槽详解
1 QT信号槽详解 1.1 信号和槽的定义 信号是触发信号,例如按钮的点击触发一个clicked信号,槽是用来接收信号,并处理信号,相当于信号响应函数.一个信号可以关联多个槽函数,信 ...
- Lua面向对象之一:简单例子
1.Lua面向对象实现步骤 ①创建一个全局表(称之为元表) ②设置这个元表的__index值(值通常为元表自己,这样就能通过__index查找到对应的属性和方法) __index 赋值其实是一个fun ...
- Codeforces 960D - Full Binary Tree Queries
960D - Full Binary Tree Queries 思路: 用move1[i]记录第i层第1种操作移动的个数(对这一层的个数取模) 用move2[i]记录第i层第2种操作移动的个数(对这一 ...
- 最新省市区数据,sql插入语句
--省数据 insert into Province (ProvinceName) values('北京市'); insert into Province (ProvinceName) value ...