关闭

1011. World Cup Betting (20)

198人阅读 评论(0) 收藏 举报
分类:

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 <bits/stdc++.h>
using namespace std;

pair<double,int> searchMax(double a,double b,double c)
{
    double m=max(max(a,b),c);
    return m==a?pair<double,int>(a,0):
    m==b?pair<double,int>(b,1):pair<double,int>(c,2);
}
int main()
{
    double ret=1.0;
    string w="WTL",ans;
    for(int i=0;i<3;++i)
    {
        double a,b,c;
        cin>>a>>b>>c;
        auto maxp=searchMax(a,b,c);
        ans+=w[maxp.second]+string(" ");
        ret*=maxp.first;
    }
    cout<<ans;
    printf("%.2lf\n",(ret*0.65-1)*2+0.000000001);
    return 0;
}
0
0
查看评论

PAT 1139. First Contact (30)-PAT甲级真题

1139. First Contact (30) Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. W...
  • liuchuo
  • liuchuo
  • 2018-01-15 15:22
  • 178

1115. Counting Nodes in a BST (30)

1115. Counting Nodes in a BST (30) 考察层序遍历#include <stdio.h> #include <malloc.h> int n1,n2; struct Node { struct Node *left,*right; ...
  • gl486546
  • gl486546
  • 2017-02-23 12:16
  • 188

PAT A1011 World Cup Betting (20)

题目地址:https://www.patest.cn/contests/pat-a-practise/1011题目描述:With the 2010 FIFA World Cup running, football fans the world over were becoming increasin...
  • xsj_blog
  • xsj_blog
  • 2016-07-24 19:35
  • 530

PAT 1011::World Cup Betting (20)

题意: 找出3个赔率最大的浮点数f1 f2 f3, 收益等于 (f1*f2*f2*0.65-1)*2  思路: 题目很简单,但是要注意 PAT中的用例有错,结果是37.97而不是37.98。(也可能是IDE的问题?) //628K 94MS #include #in...
  • a799581229
  • a799581229
  • 2017-06-02 22:45
  • 76

PAT 甲级 1011. World Cup Betting

原题传送门 就是找三组三个数中的最大值,按公式计算结果 注意:原题中的示例输出有误,实际AC的代码不需要将结果四舍五入的处理 代码一 #include <iostream> #include <algorithm> #include <iomanip> usin...
  • chao2016
  • chao2016
  • 2017-06-05 12:31
  • 159

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 ba...
  • zjujqq
  • zjujqq
  • 2013-08-29 09:59
  • 466

1011. World Cup Betting (20)-PAT

1011. World Cup Betting (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue...
  • zoushidexing
  • zoushidexing
  • 2013-07-13 21:11
  • 783

1011. World Cup Betting

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 ba...
  • LchinaM
  • LchinaM
  • 2015-02-28 15:29
  • 436

pat 1011 1011. World Cup Betting (20)

https://www.patest.cn/contests/pat-a-practise/1011 代码来自 http://blog.csdn.net/jtjy568805874/article/details/50782588 #include #include ...
  • guojiaqi007
  • guojiaqi007
  • 2017-02-27 08:34
  • 63
    个人资料
    • 访问:133251次
    • 积分:4911
    • 等级:
    • 排名:第6881名
    • 原创:371篇
    • 转载:9篇
    • 译文:0篇
    • 评论:39条
    博客专栏
    最新评论