九度题目1323:World Cup Betting
来源:互联网 发布:在线建立数据库 编辑:程序博客网 时间:2024/06/05 06:36
题目1323:World Cup Betting
时间限制:1 秒
内存限制:32 兆
特殊判题:否
提交:445
解决:194
题目描述:
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.97 yuans (accurate up to 2 decimal places).
输入:
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.
输出:
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.
样例输入:
1.1 2.5 1.7
1.2 3.0 1.6
4.1 1.2 1.1
样例输出:
T T W 37.97
//世界杯了,做一道关于世界杯的题
AC代码:
#include<stdio.h>#include<string.h>char Fun(int n){ int m=n+1; if(m==1) return 'W'; if(m==2) return 'T'; if(m==3) return 'L';}double a[5];char s[5];int main(){ int i,j,x; double n,max; char m; x=0; for(i=0;i<3;i++) { max=-1; for(j=0;j<3;j++) { scanf("%lf",&n); if(n>max) { max=n; m=Fun(j); } } s[x]=m; a[x++]=max; } for(i=0;i<3;i++) printf("%c ",s[i]); printf("%.2lf\n",(a[0]*a[1]*a[2]*0.65-1)*2.0); return 0;}
- 九度题目1323:World Cup Betting
- 九度 题目1323:World Cup Betting
- 九度OJ 1323:World Cup Betting(世界杯) (基础题)
- 1011. World Cup Betting
- 1011. World Cup Betting
- PAT1011. World Cup Betting
- PAT_1011: World Cup Betting
- PAT1011 World Cup Betting
- 1011.World Cup Betting
- pat1011 World Cup Betting
- 1011. World Cup Betting
- 1011. World Cup Betting
- 1011. World Cup Betting
- 1011. World Cup Betting
- 1011 World Cup Betting
- 1011. World Cup Betting
- PAT1011 World Cup Betting
- World Cup Betting
- cocos2d-x初学笔记09:进度条Progress
- Oracle学习(十五):分布式数据库
- 一站式购物,你何去何从
- jffs2 compression type
- 外键必须要建在主表的主键之上
- 九度题目1323:World Cup Betting
- swift中的?和!
- nyoj170网络的可靠性
- Distinct Subsequences
- SSH框架整体理解和总结(框架分析+环境搭建+实例源码下载)
- UVA 10555 - Dead Fraction(数论+无限循环小数)
- android模拟器获取ROOT权限!!!安卓
- Excel公式:将度分秒格式转换成度的格式
- Unity4.x新动画系统Mecanim使用