Programming Ability Test学习 1011. World Cup Betting (20)

1011. World Cup Betting (20)

时间限制

400 ms

内存限制

65536 kB

代码长度限制

16000 B

判题程序

Standard

作者

CHEN, Yue

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 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


提交代码

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<map>
#define MAXSIZE 100005
typedef long long ll;

using namespace std;

typedef struct Node{
	double val;
    char c;
}node;

typedef struct NNode{
	node a[3];
}nnode;

//*******常用基本函数*******

//*******本题用到函数*******
double Max(double a,double b)
{
	return a>b?a:b;
}

double GetPro(double a,double b,double c)
{
	return (0.65*a*b*c-1)*2;
}

int main()
{
	nnode AA[3];
	double a[3];
	int jk=0;
	for(int i=0;i<3;i++)
	{
		cin>>AA[i].a[0].val>>AA[i].a[1].val>>AA[i].a[2].val;
		AA[i].a[0].c=‘W‘;
		AA[i].a[1].c=‘T‘;
		AA[i].a[2].c=‘L‘;
	}

    for(int i=0;i<3;i++)
    {
    	double k=Max(Max(AA[i].a[0].val,AA[i].a[1].val),AA[i].a[2].val);
    	if(k==AA[i].a[0].val)cout<<AA[i].a[0].c<<" ";
    	if(k==AA[i].a[1].val)cout<<AA[i].a[1].c<<" ";
    	if(k==AA[i].a[2].val)cout<<AA[i].a[2].c<<" ";
    	a[jk++]=k;
    }
    //cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    printf("%.2lf\n",GetPro(a[0],a[1],a[2]));
	return 0;
}

  

时间: 2024-10-08 17:09:03

Programming Ability Test学习 1011. World Cup Betting (20)的相关文章

1011. World Cup Betting (20)

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 bet

1011. World Cup Betting (20)——PAT (Advanced Level) Practise

题目信息: 1011. World Cup Betting (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 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

PATA 1011 World Cup Betting (20)

1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 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 battl

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

PAT (Advanced Level) Practice 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

PAT (Advanced Level) 1011. World Cup Betting (20)

简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<cstdio> using namespace std; double a[5][5],Max[5]; double ans=1; int main() { for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) scanf(&qu

Programming Ability Test学习 1033. 旧键盘打字(20)

1033. 旧键盘打字(20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现.现在给出应该输入的一段文字.以及坏掉的那些键,打出的结果文字会是怎样? 输入格式: 输入在2行中分别给出坏掉的那些键.以及应该输入的文字.其中对应英文字母的坏键以大写给出:每段文字是不超过105个字符的串.可用的字符包括字母[a-z, A-Z].数字0-9.以及下划线

PAT甲题题解-1011. World Cup Betting (20)-误导人的水题。。。

题目不严谨啊啊啊啊式子算出来结果是37.975样例输出的是37.98我以为是四舍五入的啊啊啊,所以最后输出的是sum+0.005结果告诉我全部错误啊结果直接保留两位小数就可以了啊啊啊啊 水题也不要这么坑人啊啊啊啊 #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> using namespace std; int main() { double a[3];

Programming Ability Test学习 1017. A除以B (20)

1017. A除以B (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数.你需要输出商数Q和余数R,使得A = B * Q + R成立. 输入格式: 输入在1行中依次给出A和B,中间以1空格分隔. 输出格式: 在1行中依次输出Q和R,中间以1空格分隔. 输入样例: 123456789050987654321 7 输出样例: 176366