1011. World Cup Betting (20)
来源:互联网 发布:pstn网络 编辑:程序博客网 时间:2024/05/30 04:47
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">题目:</span>
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 <iomanip>using namespace std;int main(){float odds,maxodds,maxprofit=1;char best[7];char poss_resu[3]={'W' ,'T', 'L'};int k;for(int i=0;i<3;i++){cin>>maxodds;k=0;for(int j=1;j<3;j++){cin>>odds;if(odds>maxodds){maxodds=odds;k=j;}}maxprofit *= maxodds;best[2*i]=poss_resu[k];best[2*i+1]= ' ';}best[6]= '\0';maxprofit=(maxprofit*0.65-1)*2;cout<<best<<setiosflags(ios::fixed)<<setprecision(2)<<maxprofit;return 0;}
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- 1011. World Cup Betting (20)
- oracle 数据类型详解---日期型
- CF31D 分治
- 1010. Radix (25)
- Flatten Binary Tree to Linked List
- Swift中的!和?
- 1011. World Cup Betting (20)
- SQL Server不区分大小写的问题
- 图像处理+机器学习相关资源整合
- PHP关闭notice级别的错误提示
- 1012. The Best Rank (25)
- Handler消息传递机制(三)管理MessageQueue的Looper
- Android截屏方法
- 滚动条和滑动块
- iOS 开发,工程中混合使用 ARC 和非ARC