PAT (Advanced Level) Practise 1011 World Cup Betting
来源:互联网 发布:js实现格式化html代码 编辑:程序博客网 时间:2024/04/30 05:27
1011. World Cup Betting (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 L1.1 2.5 1.71.2 3.0 1.64.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 Input1.1 2.5 1.71.2 3.0 1.64.1 1.2 1.1Sample Output
T T W 37.98
题意:有三场比赛,比赛结果有赢、平、输,每场买一个,要获得最大利润
#include <iostream>#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>#include <stack>#include <queue>#include <vector>#include <map>using namespace std;int main(){ double sum; double a[3],b[3],c[3],ma; while(~scanf("%lf %lf %lf",&a[0],&b[0],&c[0])) { sum=1; for(int i=1; i<3; i++) scanf("%lf %lf %lf",&a[i],&b[i],&c[i]); for(int i=0; i<3; i++) { ma=-1; ma=max(ma,a[i]); ma=max(ma,max(b[i],c[i])); sum*=ma; if(ma==a[i]) printf("W "); else if(ma==b[i]) printf("T "); else printf("L "); } printf("%.2lf\n",sum*1.3-2); } return 0;}
- PAT (Advanced Level) Practise 1011 World Cup Betting (20)
- PAT (Advanced Level) Practise 1011World Cup Betting (20)
- PAT (Advanced Level) Practise 1011 World Cup Betting
- PAT (Advanced Level) Practise 1011. World Cup Betting (20)
- PAT (Advanced Level) Practise 1011. World Cup Betting (20)
- Pat(Advanced Level)Practice--1011(World Cup Betting)
- PAT-PAT (Advanced Level) Practise 1011. World Cup Betting (20) (套公式) 【一星级】
- 1011. World Cup Betting (20)——PAT (Advanced Level) Practise
- 【PAT Advanced Level】1011. World Cup Betting (20)
- 【c++】PAT (Advanced Level)1011. World Cup Betting (20)
- 【PAT (Advanced Level)】1011. World Cup Betting (20)
- [PAT (Advanced Level) ]1011. World Cup Betting 解题文档
- 浙大 PAT Advanced level 1011. World Cup Betting
- 【PAT】【Advanced Level】1011. World Cup Betting (20)
- PAT (Advanced) 1011. World Cup Betting (20)
- PAT 1011 World Cup Betting
- PAT 1011 World Cup Betting
- PAT (Advanced Level) 1011. World Cup Betting (20) 求最大期望值,简单题
- [BJOI2006] 狼抓兔子
- InvocationHandler中invoke方法中的第一个参数proxy的用途
- JS正则表达式常用总结
- 学习R语言 分词
- Linux系统安装时分区的方案
- PAT (Advanced Level) Practise 1011 World Cup Betting
- [LeetCode]Kth Largest Element in an Array
- 数组
- Boost库的简介与安装
- C/C++子函数参数传递,堆栈帧、堆栈参数详解_1
- 《UNIX网络编程卷1》第一例及问题
- 洛谷 P1339 [USACO09OCT]热浪Heat Wave(用Dij)
- 1005. 继续(3n+1)猜想 (25)
- CF