PAT A1011 World Cup Betting(20)
AC代码
#include <cstdio>
#include <algorithm>
const int max_n = 3;
using namespace std;
/*
struct Bet {
double W, T, L
}bet[3];
void init() {
for(int i = 0; i < max_n; i++) {
bet[i].W = bet[i].T = bet[i].L = 0.0;
}
}
*/
int main() {
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif // ONLINE_JUDGE
char str[] = {'W', 'T', 'L'};
int str_record[3] = {0};
double max_record[3] = {0.0};
for(int i = 0; i < max_n; i++) {
double W = 0.0, T = 0.0, L = 0.0;
scanf("%lf%lf%lf", &W, &T, &L);
max_record[i] = (W>T)?(W>L?W:L):(T>L?T:L); //通过三元运算符比较大小
//printf("max_record[%d]:%lf\n", i, max_record[i]);
double temp = max_record[i];
//printf("temp:%lf\n", temp);
int j = temp==W?0:(temp==T?1:(temp==L?2:-1));//通过三元运算符确定哪个概率最大
//printf("num:%d\n", j);
str_record[i] = j;
max_record[i] = temp;
}
for(int i = 0; i < max_n; i++) {
printf("%c ", str[str_record[i]]);
}
double result = 0.0;
result = (max_record[0] * max_record[1] * max_record[2] * 0.65 - 1) * 2;//
printf("%.2f", result);
return 0;
}
PAT A1011 World Cup Betting(20)的更多相关文章
- 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 ...
- pat1011. World Cup Betting (20)
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(20 分)
1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...
随机推荐
- Python回归分析五部曲(二)—多重线性回归
基础铺垫 多重线性回归(Multiple Linear Regression) 研究一个因变量与多个自变量间线性关系的方法 在实际工作中,因变量的变化往往受几个重要因素的影响,此时就需要用2个或2个以 ...
- 图文并茂VLAN详解,让你看一遍就理解VLAN
一.为什么需要VLAN 1.1.什么是VLAN? VLAN(Virtual LAN),翻译成中文是“虚拟局域网”.LAN可以是由少数几台家用计算机构成的网络,也可以是数以百计的计算机构成的企业网络.V ...
- find命令计算代码行数
[anonymous@localhost ~/lvs/ipvsadm- -regex '.*Makefile.*' -o -regex '.*\.[ch]' -exec cat {} \; | wc ...
- python 找出数组重复的元素
""" 从头扫到尾,只要当前元素值与下标不同,就做一次判断,numbers[i]与numbers[numbers[i]], 相等就认为找到了重复元素,返回true,否则就 ...
- Go 通道(channel)与协程间通信
协程间通信 协程中可以使用共享变量来通信,但是很不提倡这样做,因为这种方式给所有的共享内存的多线程都带来了困难. 在 Go 中有一种特殊的类型,通道(channel),就像一个可以用于发送类型化数据的 ...
- Netty使用(一)
1.Netty介绍 Netty是一款基于NIO(Nonblocking I/O,非阻塞IO)开发的网络通信框架: 提供异步的.事件驱动的网络应用程序框架和工具,用以快速开发高性能.高可靠性的网络服务器 ...
- word2vec原理与代码
目录 前言 CBOW模型与Skip-gram模型 基于Hierarchical Softmax框架的CBOW模型 基于Negative Sampling框架的CBOW模型 负采样算法 结巴分词 wor ...
- RunHelper,一个为跑步而设计的开源的android app
RunHelper是一个为跑步而设计的android应用,意在为爱跑步的人提供一个简洁.实用.免费的工具. 我自己也经常跑步,也用过像Nike running.runkeeper之类的app:Nike ...
- mongodb 安装配置及简单使用
步骤一: 下载网址:https://www.mongodb.com/download-center/community 根据自己的环境下载 步骤二: 安装过程只需要默认即可,需要注意的是连接工具“mo ...
- LC 813. Largest Sum of Averages
We partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the su ...