1011. World Cup Betting (20)
2015-07-15 16:32
176 查看
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the bestplayers from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting fans wereputting 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:
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
Sample Output
提交代码
——————————
睡醒了,好无聊。。。。
我发现有个问题,也是编译器的问题。
在我的DEVCPP上面呢,
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
提交代码
——————————
睡醒了,好无聊。。。。
我发现有个问题,也是编译器的问题。
在我的DEVCPP上面呢,
double tt=(ans[0]*ans[1]*ans[2]*0.65-1)*2; printf("%.2lf",tt);输出的为没有四舍五入的,额,这就比较烦,可以我提交之后,结果是正确的。
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
char c[3][2]={"W","T","L"};
double ans[3]={0};
for(int i=0; i<3; i++)
{
double tmp=0,res=-1;
int index=0,j=0;
for(j=0; j<3; j++)
{
scanf("%lf",&tmp);
if(tmp>res)
{
res=tmp;
index=j;
}
}
ans[i]=res;
printf("%s ",c[index]);
}
double tt=(ans[0]*ans[1]*ans[2]*0.65-1)*2; printf("%.2lf",tt);
return 0;
}
相关文章推荐
- Geometry cannot have Z values
- struts1源码分析(三)请求处理主线
- Burp Suite安装及详细使用教程-Intruder模块详解
- 在PPT中插入并嵌入SWF文件图文教程
- android保存图片到本地sd卡
- Burp Suite安装及详细使用教程-Intruder模块详解
- test
- linux中如何修改文件夹的用户权限 chown命令
- 【转】深入理解Java的接口和抽象类
- window 下 利用gradle编译volley源代码
- PowerDesign连接mysql数据库
- 车轮碰撞体(wheelcollider)
- 解决 TinyXML中文乱码的问题
- Apache Jmeter压力测试神器-快速入门
- 嵌入Linux开发环境搭建--secruceCRT配置
- HDU 4640 Island and study-sister(状态压缩DP+路径压缩)经典 旅行商问题
- 高性能网站性能优化与系统架构(ZT)
- sql注入原理
- [leedcode 82] Remove Duplicates from Sorted List II
- Swift基础之闭包