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 "algorithm"
#include<iomanip>//注意关于小数数位的头文件
using namespace std;

int main()
{
float a[3][3];
int b[3],t=0,temp;
float max,sum=1;
for(int i=0;i<3;i++)
{
max=0;
for(int j=0;j<3;j++)
{
cin >> a[i][j];
if(max<=a[i][j])
{
max = a[i][j];
temp = j;
}
}
b[t++]=temp;
sum *=max;
}
for(int j=0;j<t;j++)
{
if(b[j]==0)
cout<<"W"<<" ";
else if(b[j]==1)
cout<<"T"<<" ";
else
cout<<"L"<<" ";
}
cout<<setiosflags(ios::fixed);//如果为cout<<setiosflags(ios::fixed)<<cout.precision(2);则会输出一个6
cout.precision(2);//设置小数点后为两位
cout<<((sum*0.65-1)*2)<<endl;

return 0;
}

浙大pat 1011题解的更多相关文章

  1. 浙大pat 1035题解

    1035. Password (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare f ...

  2. 浙大pat 1025题解

    1025. PAT Ranking (25) 时间限制 200 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Programmi ...

  3. 浙大PAT 7-06 题解

    #include <stdio.h> #include <iostream> #include <algorithm> #include <math.h> ...

  4. 浙大pat 1012题解

    1012. The Best Rank (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To eval ...

  5. 浙大 pat 1003 题解

    1003. Emergency (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue As an emerg ...

  6. 浙大 pat 1038 题解

    1038. Recover the Smallest Number (30) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHE ...

  7. 浙大 pat 1047题解

    1047. Student List for Course (25) 时间限制 400 ms 内存限制 64000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Y ...

  8. 浙大pat 1054 题解

    1054. The Dominant Color (20) 时间限制 100 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard Behind the scen ...

  9. 浙大pat 1059 题解

    1059. Prime Factors (25) 时间限制 50 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 HE, Qinming Given ...

随机推荐

  1. trove 开发者阅读翻译

    介绍 Trove为OpenStack提供数据库的服务.它的设计运行完全符合OpenStack,目标是让用户能快速.轻松地利用关系数据库的特点,没有负担的处理复杂的管理任务.云用户和数据库管理员可以根据 ...

  2. Android studio使用smack连接xmpp服务器收发消息

    我使用的是ejabberd16.09的Linux版本,安装教程网上有很多,我在这里只介绍一下Android端连接.登录和收发消息的方法.文章最后附上了我写的一个demo,欢迎大家参考. ejabber ...

  3. 本地存储 cookie,session,localstorage( 二)angular-local-storage

    原文:https://github.com/grevory/angular-local-storage#api-documentation Get Started (1)Bower: $ bower ...

  4. openui5中的RESTful实现odata协议

    这篇文章第一次看到就一见如故,它是对过去一个时代分布式计算模型的总结,<分布式计算编程模型之RPC>:http://www.infoq.com/cn/news/2016/04/Distri ...

  5. 修改cookie

    查看本地cookie方法一:点击 地址栏前面的 感叹号 !方法一:F12-->network->回车 请求一下 地址栏-->.出现的地址-->点击. header cookie ...

  6. mac下virtualbox配置全网通

    mac下virtualbox实现主机和虚拟机.虚拟机和外网互访的方案 全局添加Host-Only网络 Adapter IPv4 Address:192.168.56.1 IPv4 Network Ma ...

  7. WindowsServer2012 R2 64位中文标准版(IIS8.5)下手动搭建PHP环境详细图文教程(二)安装IIS8.5

    //来源:http://www.imaoye.com/Technology/WindowsServer2012R264IIS85.html 阿里云服务器ECS Windows Server 2012 ...

  8. angular-file-upload+springMVC的使用

    最近项目中需要用到文件上传,使用了angular-file-upload插件完成 首先来介绍下这个插件的一些属性(参考官方文档) FileUploader 属性 url {String}: 上传文件的 ...

  9. python json.load 的奇葩错误

    json.load() 可以参数是文件对象, 但是这种方式会遇到莫名其妙的错误: No JSON object could be decoded 有的朋友说的是utf-8编码有BOM和无BOM造成的. ...

  10. HDU 5868 Different Circle Permutation

    公式,矩阵快速幂,欧拉函数,乘法逆元. $an{s_n} = \frac{1}{n}\sum\limits_{d|n} {\left[ {phi(\frac{n}{d})×\left( {fib(d ...