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 ...
随机推荐
- commander.js 制作简易的 MINA CLI 脚手架
出发点并不是小程序本身,是想要做一个脚手架(command-line interface),看过 VUE / REACT 脚手架,觉得很厉害,但是并不太知道里面是怎么做成的,所以最近研究了研究,看能不 ...
- Android 验证APK是否已经签名或是否是Debug签名
https://source.android.google.cn/ http://www.android-doc.com/tools/publishing/app-signing.html Signi ...
- Android 查看system/bin目录下支持哪些命令?
C:\Users\yonghuming>adb shell "ls system/bin" >log acpiadbdamapp_processapp_process3 ...
- openstack-networking-neutron(一)---端到端和点到点的理解
本博客已经添加"打赏"功能,"打赏"位置位于右边栏红色框中,感谢您赞助的咖啡. ====本文目的===== 理解搞清楚两个概念: 1.端到端 2.点到点 ...
- window上安装pymysql
date: 2018-11-26 18:54:04 安装: cmd: pip install pymysql 验证: cmd: python >>import pymysql 不报错即 ...
- 使用java实现的socket代理(支持socket4和socket5)
代码如下: import java.io.*; import java.net.InetAddress; import java.net.ServerSocket; import java.net.S ...
- javaagent
-javaagent:<jarpath>[=<options>]load Java programming language agent, see java.lang.inst ...
- Node.js 文件系统fs模块
Node.js 文件系统封装在 fs 模块是中,它提供了文件的读取.写入.更名.删除.遍历目录.链接等POSIX 文件系统操作. 与其他模块不同的是,fs 模块中所有的操作都提供了异步的和 同步的两个 ...
- echarts饼图如何设置悬浮提示框在中间显示?
http://www.echartsjs.com/option.html#tooltip.position tooltip.position string, Array, Function 提示框 ...
- tomcat内存溢出:PermGen space解决方法
最近集群服务器中的几台服务器在半夜自动重启tomcat后一段时间便都会报java.lang.OutOfMemoryError: PermGen space. 习惯性的百度,得到的答案基本上都是统一的解 ...