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. C语言实现简单的哈希表

    这是一个简单的哈希表的实现,用c语言做的. 哈希表原理 这里不讲高深理论,只说直观感受.哈希表的目的就是为了根据数据的部分内容(关键字),直接计算出存放完整数据的内存地址. 试想一下,如果从链表中根据 ...

  2. springMVC课程笔记(一)springMVC架构原理分析

    一.springMVC架构原理分析 1.先搞清楚什么是springMVC: 其实springMVC是spring框架中的一个模块,springMVC和spring无需通过中间整合层整合,SpringM ...

  3. quartz中的corn表达式

    一个Quartz的CronTrigger表达式分为七项子表达式,其中每一项以空格隔开,从左到右分别是:秒,分,时,月的某天,月,星期的某天,年:其中年不是必须的,也就是说任何一个表达式最少需要六项! ...

  4. Spring Boot ERROR StatusLogger No Log4j 2 configuration file found

    1. 问题描述 项目之前的 log4j2 配置没问题,把 pom 文件中的 spring-boot-starter-web 依赖删除后,然后启动项目就报错找不到 log4j2.yml 文件. 之前引用 ...

  5. 关于php文件操作的几个小trick

    记录一些ctf题目中近期遇到的一些文件操作trick,不定时更新 1.move_uploaded_file 一般用来保存上传的文件,第二个参数一般是最终保存的文件名,针对此函数,若在一定条件下$new ...

  6. MySQL优化相关参数--先做个记录,以后可能用得到

    innodb_io_capacity:可设置的磁盘IO性能参数,越高代表当前mysql的IO性能更好,可用做决策刷脏页速度的参数: innodb_flush_neighbors:刷脏页是否开启连坐机制 ...

  7. 安装wget 、 wget命令

    今天给服务器安装新LNMP环境时,wget 时提示 -bash:wget command not found,很明显没有安装wget软件包.一般linux最小化安装时,wget不会默认被安装. 可以通 ...

  8. 在js中创建命名空间的几种写法

    在JavaScript中全局变量经常会引起命名冲突,甚至有时侯重写变量也不是按照你想像中的顺序来的,可以看看下面的例子:   var sayHello = function() { return 'H ...

  9. Filebeat使用

    1.Beat家族 Beats可以直接(或者通过Logstash)将数据发送到Elasticsearch,在那里你可以进一步处理和增强数据,然后在Kibana中将其可视化. 2.FileBeat安装 2 ...

  10. HearthBuddy炉石兄弟 如何调试ai

    Sepefeets's update to botmaker's Silverfish AI This AI is a Custom Class for Hearthranger and Hearth ...