1011 World Cup Betting (20)(20 point(s))
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))的更多相关文章
- 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 ...
- PAT 甲级 1011 World Cup Betting (20)(代码+思路)
1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...
- 1011 World Cup Betting (20 分)
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over wer ...
- 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 ...
- pat 1011 World Cup Betting(20 分)
1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...
- 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 ...
- 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 ...
- PATA 1011 World Cup Betting (20)
1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...
- PAT 1011 World Cup Betting
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over w ...
- 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 ...
随机推荐
- 20155202 2016-2017-2 《Java程序设计》第7周学习总结
20155202 2016-2017-2 <Java程序设计>第7周学习总结 教材学习内容总结 世界协调时间:UTC 采用 闰秒修正 Epoch为某特定时代开始,时间轴上某一瞬间 Unix ...
- 2016.6.17——Valid Parentheses
Valid Parentheses 本题收获: 1.stack的使用 2.string和char的区别 题目: Given a string containing just the character ...
- Hibernate5笔记4--单表查询
单表查询: Hibernate是DAO层技术,对数据的使用,查询是最为重要的.Hibernate的查询技术非常强大,支持原始SQL语句查询,支持QBC查询及Hibernate特有的HQL查询. H ...
- Print Numbers by Recursion
Print numbers from 1 to the largest number with N digits by recursion. Notice It's pretty easy to do ...
- Resouce, platform_device 和 platform_driver 的关系【转】
转自:http://blog.csdn.net/uruita/article/details/7278313 從2.6版本開始引入了platform這個概念,在開發底層驅動程序時,首先要確認的就是設備 ...
- python字典解析
import json # coding: utf-8 from functools import singledispatch from collections import abc import ...
- C# 应用程序配置文件App.Config和web.config
应用程序配置文件,对于asp.net是 web.config,对于WINFORM程序是 App.Config(ExeName.exe.config). 配置文件,对于程序本身来说,就是基础和依据,其本 ...
- 在VirtualBox上安装Ubuntu
Windows 10家庭中文版,VirtualBox 5.2.12 r122591,Ubuntu ubuntu-18.04-desktop, 前言 很久没用过Linux类的操作系统了,上一次是好多年前 ...
- 签名DLL
签名DLL 首先需要一个密钥文件,后缀为.snk 密钥文件使用sn.exe 创建: sn.exe /k MySingInKey.snk sn.exe 工具的具体使用,可以通过 sn.exe /h 或 ...
- java 多线程总结篇4——锁机制
在开发Java多线程应用程序中,各个线程之间由于要共享资源,必须用到锁机制.Java提供了多种多线程锁机制的实现方式,常见的有synchronized.ReentrantLock.Semaphore. ...