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 ...
随机推荐
- 使用Flask搭建基于unittest的简单用例挑选及执行平台
在用例组织上,unittest的Test Suite的拥有非常好的灵活性,然而Test Suite一般要提前编制好,添加和组织用例必须使用代码,不方便使用. 本文使用 Flask + unittest ...
- 初学c++动态联编
先看一下什么是C++联编? 我觉得通俗的讲,用对象来访问类的成员函数就是静态联编. 那什么是动态联编: 一般是通过虚函数实现动态联编. 看一个动态联编的例子: 我比较懒,所以直接粘贴了MOOC视频的图 ...
- python 绘制sinx
code import turtle import math turtle.speed() turtle.penup() turtle., * math.sin((-/) * * math.pi)) ...
- oracle面试题2
1.题目要求 为管理岗位业务培训信息,建立3个表:S (S#,SN,SD,SA) S#,SN,SD,SA 分别代表学号.学员姓名.所属单位.学员年龄C (C#,CN ) C#,CN 分别代表课程编号. ...
- mysql: error while loading shared libraries: libnuma.so
安装mysql后,执行初始化配置脚本,创建系统自带的数据库和表时报异常: [root@VM_0_12_centos mysql]# scripts/mysql_install_db --basedir ...
- IN和EXISTS、not in 和not exists的效率详解
从效率来看: 1) select * from T1 where exists(select 1 from T2 where T1.a=T2.a) ; T1数据量小而T2数据量非常大时,T1<& ...
- ARTS打卡计划第十一周
Algorithms: https://leetcode-cn.com/problems/linked-list-cycle/ 链表环. Review: “What I learned from do ...
- 使用editcap.exe分割pcap文件
特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...
- OUC_Summer Training_ DIV2_#14 724
又落下好多题解啊...先把今天的写上好了. A - Snow Footprints Time Limit:1000MS Memory Limit:262144KB 64bit IO F ...
- cvxpy给的ADMM_example报错
x = Variable((3, 1), name="x") ValueError: Cannot broadcast dimensions (3, 1) (3, ) 解决方案: ...