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 Input1.1 2.5 1.7 1.2 3.0 1.6 4.1 1.2 1.1Sample Output
T T W 37.98
题目大意:
随着2010年世界杯的举办,世界各地的足球迷们正变得越来越兴奋,因为最优秀的球员都在为南非世界杯的奖杯而战。同样的,足球博彩的球迷们通过各种各样的世界杯赌注把他们的钱放在了他们的嘴里。
中国足球彩票提供了一个“三赢”的游戏。获胜的规则很简单:首先选择三场比赛。然后,对于每一个选择的游戏,押注三种可能的结果之一,即W代表胜利,T代表平局,L代表输。每个结果都有一个奇数。胜出者的奇数将是3个几率乘以65%的乘积。
例如,3场比赛的几率如下:
W T L
1.1 2.5 1.7
1.2 3.0 1.6
4.1 1.2 1.1
为了获得最大的利润,我们必须购买第三局的W,第2局的T,和第1局的T。如果每个下注2元,那么最大利润将是(4.1*3.0*2.5*65%-1)*2 = 37.98元(精确到小数点后2位)。
输入
每个输入文件包含一个测试用例。每个案例包含3个游戏的投注信息。每一种游戏都有三种不同的概率对应于W, T和L。
输出
对于每一个测试用例,每一款游戏的最佳下注点数,最大利润精确到小数点后两位。字符和数字必须用一个空格隔开。
代码:
#include<stdio.h>
#include<math.h>
int main()
{
double arr[5][5],num,sum=1,k,t,p;
int i,j,n,m;
char c,d[3];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%lf",&num);
if(j==0)
{
c='W';
k=num;
}else
{
if(k<num)
{
k=num;
if(j==1)
c='T';
else
c='L';
}
}
}
d[i]=c;
sum*=k;
}
t=(sum*0.65-1)*2;
printf("%c %c %c %.2lf",d[0],d[1],d[2],t);
//printf("%lf\n",round(3797.5)/100);
return 0;
}