problem

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

tip

answer

#include<bits/stdc++.h>
using namespace std; #define INF 0x3f3f3f3f float GetMax(float a, float b, float c){
return max(max(a, b),c);
} int GetStatus(float a, float b, float c){
if (a > b){
if( a > c) return 0;
else return 2;
}
if(a < b){
if( b > c) return 1;
else return 2;
}
return -1;
}
int main(){
// freopen("test.txt", "r", stdin);
float a, b, c, mul = 1;
for(int i = 0; i < 3; i++){
cin>>a>>b>>c;
mul *= GetMax(a, b, c);
switch(GetStatus(a, b, c)){
case 0: cout<<"W ";break;
case 1: cout<<"T ";break;
case 2: cout<<"L ";break;
default: return -1;
}
} cout<<fixed<<setprecision(2)<<(mul*0.65 - 1)*2;
return 0;
}

experience

  • 加快速度,这题目还要20分钟?

1011 World Cup Betting (20)(20 point(s))的更多相关文章

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

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

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

  3. 1011 World Cup Betting (20 分)

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

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

  5. pat 1011 World Cup Betting(20 分)

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

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

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

  8. PATA 1011 World Cup Betting (20)

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

  9. PAT 1011 World Cup Betting

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

  10. PAT 甲级 1001 A+B Format (20)(20 分)

    1001 A+B Format (20)(20 分) Calculate a + b and output the sum in standard format -- that is, the dig ...

随机推荐

  1. 20155321 2016-2017-2 《Java程序设计》第六周学习总结

    20155321 2016-2017-2 <Java程序设计>第六周学习总结 教材学习内容总结 第十章 IO 流 IO 流用来处理设备之间的数据传输 Java对数据的操作是通过流的方式 J ...

  2. HDU 4548 美素数 在线打表加数状数组

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4548 解题报告:一开始本想先打个素数表,然后每次输入L 跟R 的时候都进行暴力判断,但这题测试数据太多 ...

  3. c++刷题(9/100):链表

    题目一:https://www.nowcoder.com/practice/d0267f7f55b3412ba93bd35cfa8e8035?tpId=13&tqId=11156&tP ...

  4. JavaScript的基本介绍

    JavaScript入门介绍 输出语句:document.write()   1.执行顺序:从上到下,每一天语句是要加分号的,如果不加的话,浏览器会默认帮你自动添加,分号.   2.注释:一行注释就是 ...

  5. Celery异步任务队列/周期任务+ RabbitMQ + Django

    一.Celery介绍和基本使用  Celery 是一个 基于python开发的分布式异步消息任务队列,通过它可以轻松的实现任务的异步处理, 如果你的业务场景中需要用到异步任务,就可以考虑使用celer ...

  6. Python练习-从小就背不下来的99乘法表

    心血来潮,灵机一动,反正就是无聊的做了一个很简单的小玩意: for i in range(1,10):#让i 1-9 循环9次 print("\n")#每循环一次进行一次换行 fo ...

  7. imperva-指定url禁止访问

    指定url禁止访问 应用到那个网站 访问一下查看告警

  8. 华硕笔记本U盘重装系统

    ESC启动把Secure Boot改为Disabled,Launch CSM改为Enabled,然后重新选择不带UEFI字样的U盘启动项.然后就可以找到U盘进入PE

  9. Operfire 安装指南

    http://www.cnblogs.com/hoojo/archive/2012/05/13/2498151.html 本文的英文原文来自 http://www.igniterealtime.org ...

  10. [ python ] 学习目录大纲

    简易博客[html+css]练习 MySQL 练习题及答案 MySQL视图.触发器.函数.存储过程 MySQL 操作总结 Day41 - 异步IO.协程 Day39/40 - 线程的操作 Day36/ ...