PAT 1011 World Cup Betting
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.1 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 ( yuans (accurate up to 2 decimal places).
Input Specification:
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 Specification:
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.1 1.6
4.1 1.2 1.1
Sample Output:
T T W 39.31
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxnum 100005 double shuzu[][]; int main(){ for(int i=;i < ;i++){
for(int j=;j < ;j++){
cin >> shuzu[i][j];
}
} double sum = 1.0;
for(int i=;i < ;i++){
map<double,char> mp;
mp[shuzu[i][]] = 'W';
mp[shuzu[i][]] = 'T';
mp[shuzu[i][]] = 'L';
double t = max(shuzu[i][],max(shuzu[i][],shuzu[i][]));
sum*=t;
cout << mp[t] << " ";
}
sum = (sum*0.65-)*;
printf("%.2lf",sum); return ;
}
傻逼题写了半个小时,还是一开始没想明白就上手写了,结果写的时候一直再改。
还有要熟悉结构化编程,每次实现一个功能可以先试一下正确不正确。
PAT 1011 World Cup Betting的更多相关文章
- 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 1011 World Cup Betting 查找元素
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
- PAT 1011 World Cup Betting (20分) 比较大小难度级别
题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...
- 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)(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 ...
- 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 ...
- 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 ...
- 1011 World Cup Betting (20 分)
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over wer ...
随机推荐
- 【Hadoop 分布式部署 七: 使用ntp配置内网中集群机器时间同步 】
集群的时间要同步,如果时间不同步,会出现很多问题. 找一台机器做时间服务器 所有的机器与这台机器的时间进行定时的同步 比如,每日十分钟同步一次 我们这里使用 hadoop-senior.zuoyan ...
- spring 配置事务xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...
- 【bzoj】4538: [Hnoi2016]网络
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=4538 维护一个数据结构支持对于一颗树的操作,需要支持: 1.对于树上的一条路径上的每个点上 ...
- N的阶乘(10000) 51 nod——1057 (大数)
像这些大整数加法或者乘法什么的思想都一样,就是截位存取,累积进位,最后逆序输出就可以啦 PS:小生是用10000来存取的,300MS就能A,如果单个存取有点危险,题目时间限制好像是1000ms,大家可 ...
- Windows下pipenv将虚环境文件的位置设置在项目根目录下
在windows下使用pipenv shell时,虚拟环境文件夹会在C:\Users\Administrator\.virtualenvs\目录下默认创建,为了方便管理,将这个虚环境的文件的位置更改一 ...
- cordova + Vue 开发 APP 上手指南
什么是 cordova cordova 是由 Apache 基金会支持的,使用 HTML5 + CSS3 + JS 来构建多平台 APP 程序的开发框架.其支持调用手机系统(Android.IOS.W ...
- Linux 中 MySQL常用命令
一. 数据库登录mysql -uroot -p二..退出数据库quit 和 exit或ctrl + d三.数据库操作1. 查看所有数据库 show databases;2. 查看当前使用的数据库sel ...
- 安装Linux系统的磁盘分区
●CentOS磁盘分区 分区顺序: "/"分区(逻辑) -> "/boot"分区(主分区) -> "swap"分区(逻辑) -& ...
- 算法笔记--最大流和最小割 && 最小费用最大流 && 上下界网络流
最大流: 给定指定的一个有向图,其中有两个特殊的点源S(Sources)和汇T(Sinks),每条边有指定的容量(Capacity),求满足条件的从S到T的最大流(MaxFlow). 最小割: 割是网 ...
- 线程---local数据隔离
线程之间本身是数据共享的,当多个线程同时修改一份数据的时候,数据就可能不 准确,特别是线程量特别大的时候,为了保证数据准确性: (1) 通过线程锁Lock (2)通过local数据隔离 from th ...