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 ...
随机推荐
- 什么情况下用断言?assert
可以再预计正常情况下不会到达的任何位置上放置断言,断言可以用于验证传递给私有方法的参数.不俺的参数过,断言不应该用于验证传递给公有方法的参数,因为不管是否启用了断言,公有方法都必须检查其参数.不过,既 ...
- 【ASP.Net】publish asp.net to local IIS
做web项目难免要将项目部署, 要么部署在azure上,要么部署在本地, 使用IIS去host. 部署步骤很简单, 1. vs打开你的web项目, 项目名上面右键选择publish 2. 在弹出的pu ...
- Leetcode118_Pascal's Triangle_Easy
Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's t ...
- UVa 11107 生命的形式(不小于k个字符串中的最长子串)
https://vjudge.net/problem/UVA-11107 题意:给定n个字符串,求出现在不小于n的一半个字符串的最长子串,如果有多个,则按字典序输出. 思路: 首先就是将这n个字符串连 ...
- 1月4日笔记 (vi编辑器)更新...
vi编辑器,全称是visual interface,可以执行输出.删除.查找.替换等众多的文本操作. vi并不是一个排版程序,不可以对字体.格式.段落等其他的属性进行编排. vi是全屏文本编辑程序 ...
- 如何终止线程的运行(C/C++)
想要终止线程的运行,可以使用以下方法: 1.线程函数返回(最好使用该方法). 2.通过调用ExitThread函数,线程将自行撤消(最好不使用该方法). 3.同一个进程或另一个进程中的线程调用Term ...
- 小程序之从后台取到数据后放入想要的标签list里
问题:事情是这样的,我有一个标签的功能,but 我怎么吧后台取到的数据放到我想要的标签里呢,而且是那种多个数据自己会加一个标签的内种,效果如下 解决:我们需要用到wx:for 这个东西呢是需要 ...
- 基因组与Python --PyVCF 好用的vcf文件处理器
vcf文件的全称是variant call file,即突变识别文件,它是基因组工作流程中产生的一种文件,保存的是基因组上的突变信息.通过对vcf文件进行分析,可以得到个体的变异信息.嗯,总之,这是很 ...
- 【Python】【容器 | 迭代对象 | 迭代器 | 生成器 | 生成器表达式 | 协程 | 期物 | 任务】
Python 的 asyncio 类似于 C++ 的 Boost.Asio. 所谓「异步 IO」,就是你发起一个 IO 操作,却不用等它结束,你可以继续做其他事情,当它结束时,你会得到通知. Asyn ...
- 转 这种方法可以免去自己计算大文件md5 的麻烦
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;using ...