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)的更多相关文章

  1. PAT 1011 World Cup Betting (20分) 比较大小难度级别

    题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...

  2. 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 ...

  3. 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 ...

  4. PAT 甲级 1011 World Cup Betting (20)(代码+思路)

    1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...

  5. 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 ...

  6. 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 ...

  7. pat1011. World Cup Betting (20)

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

  8. PATA 1011 World Cup Betting (20)

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

  9. pat 1011 World Cup Betting(20 分)

    1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...

随机推荐

  1. 【CUDA 基础】6.3 重叠内和执行和数据传输

    title: [CUDA 基础]6.3 重叠内和执行和数据传输 categories: - CUDA - Freshman tags: - 深度优先 - 广度优先 toc: true date: 20 ...

  2. 刚注册blog,先来刷个存在

    我想以后能够走数字ic设计的道路,努力复习考研,努力提升专业素养,2017加油!青春加油!

  3. Java web 实验三部分资料上传

    花好月圆系列 貂蝉 黄月英 孙尚香 甄姬 标准包 魏 曹操 司马懿 郭嘉 甄姬 张辽 许褚 夏侯惇 蜀 刘备 关羽 张飞 诸葛亮 黄月英 赵云 马超 吴 孙权 孙尚香 周瑜 大乔 甘宁 吕蒙 群 吕布 ...

  4. 微信小程序之scroll-view的坑

    好久没动小程序了,今天打算复习复习,结果刚写了一个scroll-view就遇到了一个坑,这怎么能忍,对比看文档也没发现那里出了问题,没办法只能去翻翻微信给的demo,发现scroll-view一个必要 ...

  5. cast()、decimal(M,D) --SQL对查询字段保留小数位操作

    参考:http://database.51cto.com/art/201005/201651.htm http://www.lai18.com/content/1693593.html 直接上例子,以 ...

  6. ES节点分析

    ES集群概念 集群 一个集群cluster由一个或者多个节点组成,具有相同的cluster.name,协同工作,分项数据和负载. 当有新的节点加入或者删除了一个节点时,集群回感知到并能够平衡数据. E ...

  7. LSTM参数和结构的本质理解——num_units参数/batch_size/cell计算

    参考 ———— 图例讲解 https://blog.csdn.net/u014518506/article/details/80445283 理解:cell其实只有一个 : sequence leng ...

  8. 使用LuceneUtil工具类,完成CURD操作

    package loaderman.curd; import java.util.ArrayList; import java.util.List; import loaderman.entity.A ...

  9. Intel64及IA-32架构优化指南第8章多核与超线程技术——8.9 其它共享资源的优化

    8.9 其它共享资源的优化 在多线程应用中的资源优化依赖于处理器拓扑层级内相关联的Cache拓扑以及执行资源.在第7章中讨论了处理器拓扑以及标识处理器拓扑的一种软件算法. 在带有共享总线的平台中,总线 ...

  10. Visual Studio Code 帮助查看器,指定的用于安装帮助内容的位置无效,或者您无权访问该位置

    今天有个C# 类库文件里面的属性想要了解下,想到了Vs的帮助文档,其实也就是微软的MSDN:提示帮助查看器,指定的用于安装帮助内容的位置无效,或者您无权访问该位置: 最近两天vs也没有更新,并且也没有 ...