1011 World Cup Betting (20)(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

//题目大意就是给出3*3矩阵,每一行表示一次比赛的结果,W是赢了,T是平局,L是输了,就找出每局的最大值做一个运算即可。

//这道题真的很简单。。

一次就AC。。

#include <iostream>
#include <cstring>
#include <cstdio>
#include<map>
#include<stack>
#include<math.h>
using namespace std; int main()
{
int maxs[];//记录每一行是第几个数最大。
fill(maxs,maxs+,);
double a[][];
map<int,char> mp;
mp.insert(make_pair(,'W'));
mp.insert(make_pair(,'T'));
mp.insert(make_pair(,'L'));
//freopen("1.txt","r",stdin);
for(int i=;i<;i++){
int ma=;
for(int j=;j<;j++){
scanf("%lf",&a[i][j]);
if(a[i][j]>ma){
maxs[i]=j;
ma=a[i][j];
}
}
}
double x=1.0;
for(int i=;i<;i++)
x*=a[i][maxs[i]];
x=(x*0.65-)*;
printf("%c %c %c %.2f",mp[maxs[]],mp[maxs[]],mp[maxs[]],x);
return ;
}//出现了一个问题,样例中答案是37.98,但是我算出来的结果是37.97,这个结果难以接受。。
//妈耶,但是提交了之后通过了,20分。。

//没什么好说的了。就是在map插入的时候要用make_pair,不能直接插入。

PAT World Cup Betting[非常简单]的更多相关文章

  1. PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...

  2. PAT 1011 World Cup Betting

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

  3. PAT 甲级 1011 World Cup Betting (20)(20 分)

    1011 World Cup Betting (20)(20 分)提问 With the 2010 FIFA World Cup running, football fans the world ov ...

  4. PAT 甲级 1011 World Cup Betting (20)(代码+思路)

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

  5. PAT甲 1011. World Cup Betting (20) 2016-09-09 23:06 18人阅读 评论(0) 收藏

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

  6. PAT 甲级 1011 World Cup Betting (20)(20 分)(水题,不用特别在乎精度)

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

  7. pat 1011 World Cup Betting(20 分)

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

  8. PAT甲级——1011 World Cup Betting

    PATA1011 World Cup Betting With the 2010 FIFA World Cup running, football fans the world over were b ...

  9. PAT1011:World Cup Betting

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

随机推荐

  1. SQL Server 索引结构及其使用(二)

    作者:freedk 一.深入浅出理解索引结构 改善SQL语句 很多人不知道SQL语句在SQL SERVER中是如何执行的,他们担心自己所写的SQL语句会被SQL SERVER误解.比如: select ...

  2. 支持向量机SVM进阶

    本文适合于对SVM基本概念有一点了解的童鞋. SVM基本概念: 最大边缘平面--基本原理:结构风险最小化 分类器的泛化误差 支持向量 问题描述: 请对一下数据,利用svm对其进行分类.       最 ...

  3. Esper学习之十五:Pattern(二)

    上一篇开始了新一轮语法——Pattern的讲解,一开始为大家普及了几个基础知识,其中有说到操作符.当时只是把它们都列举出来了,所以今天这篇就是专门详解这些操作符的,但是由于篇幅限制,本篇先会讲几个,剩 ...

  4. vue Element动态设置el-menu导航当前选中项

    1,npm install vuex --save 2,在src下新建vuex文件夹,新建store.js文件: store.js import Vue from 'vue' import Vuex ...

  5. html5里面的延迟加载属性

    html5中给script标签引入了 async 和 defer 属性. 原理:带有async属性的script标签,会在浏览器解析时立即下载脚本同时不阻塞后续的document渲染和script加载 ...

  6. Junit单元测试初识

    写过单元测试的小童鞋对于Junit一定不陌生,可小白我,刚刚开始接触,这里就把我的测试实验,做一下记录,以便以后方便查看.学习使用JUnit4,既然使用最新版本了,就不要再考虑老版本是如何使用的了,J ...

  7. Windows Server 2012设置WinDbg Kernel Debugging Local

    网上主要提到了以下两点: 1.cmd窗口输入bcdedit /debug on,重新启动计算机. 2.下载对应版本Windows符号文件,并添加环境变量_NT_SYMBOL_PATH. 其实根据环境不 ...

  8. 如何搭建Packetbeat性能监控

    安装与配置JDK 1.  将jdk-8u111-linux-x64.tar.gz上传至Linux的/opt目录下,并执行解压命令: tar -zxvf jdk-8u111-linux-x64.tar. ...

  9. 基础笔记1(进制,浮点,递归,floor,round和ceil)

    1,进制默认是十进制 0开头 8进制 0x     16进制 0b     2进制 2,long 的范围是19位数字.int范围是21亿左右,short 是三万二千左右. 超过int范围的long类型 ...

  10. split陷阱

    如果split最后一个为空,则要这么写 String[] lines=line.split(",",-1);