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

思路
很简单,找出每次比赛三种结果的最大赔率的那次结果,每三次比赛输出一下利润,套公式即可。需要特别注意保留n位小数时四舍五入和float转int的坑。
代码
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
char a[] = "WTL";
const float t = 0.65;
const float point = 0.5; int main()
{
vector<float> bet();
vector<float> maxodd();
vector<char> result;
int N = ;
while(cin >> bet[] >> bet[] >> bet[])
{
int pos = ;
if(max(bet[],bet[]) < bet[])
{
maxodd[N++] = bet[];
pos = ;
}
else if(bet[] > bet[])
{
maxodd[N++] = bet[];
pos = ;
}
else
{
maxodd[N++] = bet[];
pos = ;
}
result.push_back(a[pos]);
if(N == )
{
float profit = * (maxodd[] * maxodd[] * maxodd[] * t - ) + point;
int temp = (int)profit;
float maxprofit = ((float)temp)/;
for(int i = ;i < ;i++)
cout << result[i] << " ";
cout << maxprofit << endl;
N = ;
}
}
}

 

最新文章

  1. c# List的排序
  2. 关于python中带下划线的变量和函数 的意义
  3. 【代码】verilog之:电子钟
  4. 深入了解Activity-生命周期
  5. 算法(第4版)-1.1.1 Java程序的基本结构
  6. Python builtins
  7. PLSQL_性能优化系列13_Oracle Index Rebuild索引重建
  8. extjs4与ckeditor、ckfinder整合
  9. Python 学习日记(第二周)
  10. zk set 方法
  11. WebAPI 15 CORS
  12. [转载]【虚拟化系列】VMware vSphere 5.1 虚拟机管理
  13. 201521123012 《Java程序设计》第四周学习总结
  14. StackExchange.Redis中文使用文档
  15. intellij idea 官方帮助文档翻译(一)安装
  16. 6.基本数据结构-双端队列(Deque)
  17. HashMap Hashtable LinkedHashMap TreeMap
  18. 16进制string转成int
  19. 整理iOS9适配中出现的坑
  20. Latex 环境下“中文字体”的使用

热门文章

  1. FFMPEG列出DirectShow支持的设备
  2. C#数据库连接操作大全
  3. iOS中NSBundle的介绍
  4. HBase学习资源
  5. Android特效专辑(四)——APP主页框架TabHost绑定ViewPager的替换者TabLayout
  6. 8 个实用的 Bootstrap 3 案例教程
  7. 深入浅出Java concurrent
  8. 《MySQL必知必会》读书笔记_4
  9. 转载 jQueryEasyUI Messager基本使用
  10. kafka 集群