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

代码

 1 #include <stdio.h>
 2 
 3 int findMaxIndex(double*,int);
 4 int main()
 5 {
 6     double odd[],profit;
 7     int index1,index2,index3;
 8     const char outPut[] = {'W','T','L'};
 9     while(scanf("%lf%lf%lf",&odd[],&odd[],&odd[]) != EOF){
         index1 = findMaxIndex(odd,);
         profit = odd[index1];
         scanf("%lf%lf%lf",&odd[],&odd[],&odd[]);
         index2 = findMaxIndex(odd,);
         profit *= odd[index2];
         scanf("%lf%lf%lf",&odd[],&odd[],&odd[]);
         index3 = findMaxIndex(odd,);
         profit *= odd[index3];
         printf("%c ",outPut[index1]);
         printf("%c ",outPut[index2]);
         printf("%c ",outPut[index3]);
         profit = (profit * 0.65 - ) * ;
         printf("%.2lf\n",profit);
     }
     return ;
 }
 
 int findMaxIndex(double *dArray,int n)
 {
     if(n == )
         return -;
     int index = ;
     double maxValue = dArray[];
     int i;
     for(i=;i<n;++i){
         if(maxValue < dArray[i]){
             index = i;
             maxValue = dArray[i];
         }
     }
     return index;
 }

PAT 1011的更多相关文章

  1. PAT 1011 World Cup Betting

    1011 World Cup Betting (20 分)   With the 2010 FIFA World Cup running, football fans the world over w ...

  2. PAT 1011 A+B和C (15)(C++&JAVA&Python)

    1011 A+B和C (15)(15 分) 给定区间[-2^31^, 2^31^]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个 ...

  3. pat 1011 World Cup Betting(20 分)

    1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...

  4. PAT 1011. A+B和C (15)

    给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给出A.B ...

  5. 浙大pat 1011题解

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  6. PAT 1011 A+B和C

    https://pintia.cn/problem-sets/994805260223102976/problems/994805312417021952 给定区间[-2^31^, 2^31^]内的3 ...

  7. PAT——1011. A+B和C

    给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给出A.B ...

  8. PAT 1011 World Cup Betting 查找元素

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  9. PAT 1011 World Cup Betting (20分) 比较大小难度级别

    题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...

随机推荐

  1. 更改nginx默认的网页目录

    默认网站根目录为/usr/local/nginx/html,要将它改成/homw/www vi /usr/local/nginx/conf/nginx.conf 将其中的           loca ...

  2. 使用CSS3美化复选框checkbox

    我们知道HTML默认的复选框样式十分简陋,而以图片代替复选框的美化方式会给页面表单的处理带来麻烦,那么本文将结合实例带您一起了解一下使用CSS3将复选框checkbox进行样式美化,并且带上超酷的滑动 ...

  3. Fragment中Button的android:onClick 无法监听相应

    在Fragment的布局文件中,Button控件下添加android:onClick监听: 1.fragment_main.xml <RelativeLayout xmlns:android=& ...

  4. Delphi word

    [转载]在Delphi中使用CreateOleObject方法 (2011-08-24 14:20:47) 转载▼ 标签: 转载   原文地址:在Delphi中使用CreateOleObject方法作 ...

  5. chrome启用本地文件

    chrome禁止本地浏览时加载本地其他文件,可以采用添加启动参数的方式来支持 添加参数为 --allow-file-access-from-files  或者 --disable-web-securi ...

  6. mysql的group_concat的用法

    1.语法:group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator '分隔符']) eg. SELECT ID, GROUP ...

  7. HW6.30

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  8. EDM

    今天,夏令营需要发推广EDM. 之前的edm都是文字版, 今天摸索了一下,简单写了些码, 效果还不错. 演示:http://baike.baidu.com/cms/s/bkcampus/summerc ...

  9. 一个简单的创建圆角图像的UIImage扩展实现

    - (UIImage *)roundedCornerImageWithCornerRadius:(CGFloat)cornerRadius { CGFloat w = self.size.width; ...

  10. LDO稳压器工作原理

    LDO稳压器工作原理 随着便携式设备(电池供电)在过去十年间的快速增长,像原来的业界标准 LM340 和LM317 这样的稳压器件已经无法满足新的需要.这些稳压器使用NPN 达林顿管,在本文中称其为N ...