当前位置:网站首页>1011 World Cup betting (20 points) (pat a)
1011 World Cup betting (20 points) (pat a)
2022-07-04 19:37:00 【Acacia moon tower】
Problem Description:
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 (4.1×3.1×2.5×65%−1)×2=39.31 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
The question : Find the maximum value in each row separately , And then evaluate .
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
double fmax(double a, double b, double c) {
double t = max(a, b);
return max(t, c);
}
int main() {
double w, t, l, ans = 1;
int k = 0;
char e[5];
for(int i = 0; i < 3; i++) {
scanf("%lf %lf %lf", &w, &t, &l);
if(fmax(w,t,l) == w) {
e[k++] = 'W';
ans *= w;
} else if(fmax(w,t,l) == t){
e[k++] = 'T';
ans *= t;
} else {
e[k++] = 'L';
ans *= l;
}
}
ans = (ans*0.65-1)*2;
for(int i = 0; i < k; i++) {
printf("%c ", e[i]);
}
printf("%.2lf\n", ans);
return 0;
}
边栏推荐
- Is it safe to open an account at Great Wall Securities? How to open an account when buying stocks
- 在线SQL转Excel(xls/xlsx)工具
- Detailed explanation of the binary processing function threshold() of opencv
- The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize
- @transactional滥用导致数据源连接池耗尽问题
- Shell 编程核心技术《二》
- 1002. A+b for Polynomials (25) (PAT class a)
- BCG 使用之CBCGPProgressDlgCtrl进度条使用
- Hough transform Hough transform principle
- Shell programming core technology "three"
猜你喜欢
【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
Online sql to excel (xls/xlsx) tool
关于判断点是否位于轮廓内的一点思考
BCG 使用之新建向导效果
TCP两次挥手,你见过吗?那四次握手呢?
Use canal and rocketmq to listen to MySQL binlog logs
西门子HMI下载时提示缺少面板映像解决方案
node_ Exporter deployment
Some thoughts on whether the judgment point is located in the contour
随机推荐
矩阵翻转(数组模拟)
指定输出的字符集
Master the use of auto analyze in data warehouse
求2的n次方
1002. A+B for Polynomials (25)(PAT甲级)
Online sql to excel (xls/xlsx) tool
The difference and usage between substr (), slice (), and substring () in the string interception methods of "understand series after reading"
English语法_名词 - 使用
Qt实现界面滑动切换效果
爬虫(6) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
The CDC of sqlserver can read the data for the first time, but it can't read the data after adding, deleting and modifying. What's the reason
HDU 6440 2018中国大学生程序设计网络选拔赛
牛客小白月赛7 I 新建 Microsoft Office Word 文档
Socket programming demo II
Oracle with as ORA-00903: invalid table name 多表报错
Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
SSRS筛选器的IN运算(即包含于)用法
一文掌握数仓中auto analyze的使用
Educational Codeforces Round 22 E. Army Creation
The 15th youth informatics competition in Shushan District in 2019