PAT World Cup Betting[非常简单]
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
//题目大意就是给出3*3矩阵,每一行表示一次比赛的结果,W是赢了,T是平局,L是输了,就找出每局的最大值做一个运算即可。
//这道题真的很简单。。
一次就AC。。
#include <iostream>
#include <cstring>
#include <cstdio>
#include<map>
#include<stack>
#include<math.h>
using namespace std; int main()
{
int maxs[];//记录每一行是第几个数最大。
fill(maxs,maxs+,);
double a[][];
map<int,char> mp;
mp.insert(make_pair(,'W'));
mp.insert(make_pair(,'T'));
mp.insert(make_pair(,'L'));
//freopen("1.txt","r",stdin);
for(int i=;i<;i++){
int ma=;
for(int j=;j<;j++){
scanf("%lf",&a[i][j]);
if(a[i][j]>ma){
maxs[i]=j;
ma=a[i][j];
}
}
}
double x=1.0;
for(int i=;i<;i++)
x*=a[i][maxs[i]];
x=(x*0.65-)*;
printf("%c %c %c %.2f",mp[maxs[]],mp[maxs[]],mp[maxs[]],x);
return ;
}//出现了一个问题,样例中答案是37.98,但是我算出来的结果是37.97,这个结果难以接受。。
//妈耶,但是提交了之后通过了,20分。。
//没什么好说的了。就是在map插入的时候要用make_pair,不能直接插入。
PAT World Cup Betting[非常简单]的更多相关文章
- 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
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over w ...
- 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 ...
- 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
PATA1011 World Cup Betting With the 2010 FIFA World Cup running, football fans the world over were b ...
- PAT1011:World Cup Betting
1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...
随机推荐
- 【资源大全】.NET资源大全中文版(Awesome最新版)
算法与数据结构(Algorithms and Data structures) 应用程序接口(API) 应用程序框架(Application Frameworks) 模板引擎(Application ...
- 【抓包分析】 charles + 网易mumu 模拟器数据包
charles 的使用.我就不再多说了.可以参考以往文章,传送门: https://www.cnblogs.com/richerdyoung/p/8616674.html 此处主要说网易模拟器的使用 ...
- iPhone 上如何通过 Safari 使用 Pocket
在开始之前,请确认你的机器上已经安装了 Pocket 应用软件. 如何安装 1.打开Pocket应用,点击左上角的菜单(三条横岗),找到最下面的 Help ,点击 How To Save ,找到 ...
- Python汉字转换成拼音
最近在使用Python做项目时,需要将汉字转化成对应的拼音. 网上的一些包大多是python2.x的,使用下面这个包,支持python3.6 xpinyin 0.5.5 >>> fr ...
- SOS does not support the current target architecture解决方法
客户提交一个dump文件,WinDbg加载时出现大量WARNING,加载对应版本的SOS后执行相应命令提示"SOS does not support the current target a ...
- TX失败策略2
自从有了人类,就有了智慧和精神.但总有一些思想家跳出来说人定胜天的理论,这是一种严重的误导.人类社会和自然界一样,遵守统一的自然定律.人就像不能改变物理定律一样改社会定律.更不可能因片面的社会现象遮盖 ...
- android分辨率适配
重要概念 什么是屏幕尺寸.屏幕分辨率.屏幕像素密度? 什么是dp.dip.dpi.sp.px?他们之间的关系是什么? 什么是mdpi.hdpi.xdpi.xxdpi?如何计算和区分? 在下面的内容中我 ...
- java读取写入oracle的blob字段工具类
import com.hzunitech.fxgk.sys.model.UtFileData;import com.jfinal.kit.PathKit;import com.jfinal.plugi ...
- camke中关于变量的一些知识
一.cmake变量引用的方式: 在cmake中,使用${}进行变量的引用.在IF等语句中,是直接使用变量名而不是通过${}取值 二.cmake自定义变量的方式: 主要有隐式定义和显式定义两种,前面举了 ...
- HDU 1890 - Robotic Sort - [splay][区间反转+删除根节点]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1890 Time Limit: 6000/2000 MS (Java/Others) Memory Li ...