cdoj第13th校赛初赛A - AC Milan VS Juventus 【枚举】
http://acm.uestc.edu.cn/#/contest/show/54
A - AC Milan VS Juventus
Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)
Kennethsnow and Hlwt both love football.
One day, Kennethsnow wants to review the match in 2003 between AC Milan and Juventus for the Championship Cup. But before the penalty shootout. he fell asleep.
The next day, he asked Hlwt for the result. Hlwt said that it scored a:b in the penalty shootout.
Kennethsnow had some doubt about what Hlwt said because Hlwt is a fan of Juventus but Kennethsnow loves AC Milan.
So he wanted to know whether the result can be a legal result of a penalty shootout. If it can be, output Yes, otherwise output No.
The rule of penalty shootout is as follows:
There will be 5 turns, in each turn, 2 teams each should take a penalty shoot. If goal, the team get 1 point. After each shoot, if the winner can be confirmed(i.e: no matter what happened after this shoot, the winner will not change), the match end immediately.
If after 5 turns the 2 teams score the same point. A new turn will be added, until that one team get a point and the other not in a turn.
Before the penalty shootout begins, the chief referee will decide which team will take the shoot first, and afterwards, two teams will take shoot one after the other. Since Kennethsnow fell asleep last night, he had no idea whether AC Milan or Juventus took the first shoot.
Input
The only line contains 2 integers a, b. Means the result that Hlwt said.
0≤a,b≤10
Output
Output a string Yes or No, means whether the result is legal.
Sample input and output
| Sample Input | Sample Output |
|---|---|
3 2 |
Yes |
2 5 |
No |
Hint
The Sample 1 is the actual result of the match in 2003.
The Sample 2, when it is 2:4 after 4 turns, AC Milan can score at most 1 point in the next turn. So Juventus has win when it is 2:4. So the result cannot be 2:5.
This story happened in a parallel universe. In this world where we live, kennethsnow is a fan of Real Madrid.
思路:最简单也最不容易出错的情况就是把特殊情况都枚举出来。
官方题解:

代码:
#include <fstream>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <vector> using namespace std; #define PI acos(-1.0)
#define EPS 1e-10
#define lll __int64
#define ll long long
#define INF 0x7fffffff int main(){
//freopen("D:\\input.in","r",stdin);
//freopen("D:\\output.out","w",stdout);
int a,b;
scanf("%d %d",&a,&b);
if(a>b){
int t=a;
a=b;
b=t;
}
if(a==b) {puts("No");return ;}
if(b<=){
if(a==&&b==) {puts("No");return ;}
if(a==&&b==) {puts("No");return ;}
if(a==&&b==) {puts("No");return ;}
if(a==&&b==) {puts("No");return ;}
else {puts("Yes");return ;}
}else{
if(b-a>) {puts("No");return ;}
else {puts("Yes");return ;}
}
return ;
}
cdoj第13th校赛初赛A - AC Milan VS Juventus 【枚举】的更多相关文章
- cdoj第13th校赛初赛F - Fabricate equation
http://acm.uestc.edu.cn/#/contest/show/54 F - Fabricate equation Time Limit: 3000/1000MS (Java/Other ...
- cdoj第13th校赛初赛H - Hug the princess
http://acm.uestc.edu.cn/#/contest/show/54 H - Hug the princess Time Limit: 3000/1000MS (Java/Others) ...
- cdoj第13th校赛初赛L - Lovely princess
http://acm.uestc.edu.cn/#/contest/show/54 L - Lovely princess Time Limit: 3000/1000MS (Java/Others) ...
- UESTC 1034 AC Milan VS Juventus 分情况讨论
AC Milan VS Juventus Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Oth ...
- AC Milan VS Juventus(模拟)
AC Milan VS Juventus Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Oth ...
- SCNU省选校赛第二场B题题解
今晚的校赛又告一段落啦,终于"开斋"了! AC了两题,还算是满意的,英语还是硬伤. 来看题目吧! B. Array time limit per test 2 seconds me ...
- 2014上半年acm总结(1)(入门+校赛)
大一下学期才开始了acm,不得不说有一点迟,但是acm确实使我的生活充实了很多,,不至于像以前一样经常没事干= = 上学期的颓废使我的c语言学的渣的一笔..靠考前突击才基本掌握了语法 寒假突然醒悟, ...
- ZJU 17th 校赛
第一次参加校赛,和小伙伴们拿了7个气球,还是挺开心的. 简单记个流水账吧. A:判断出INF的情况后 暴力模拟即可. INF的情况有x=1 || y=1 || (x==2 && y= ...
- ZOJ 3955 Saddle Point 校赛 一道计数题
ZOJ3955 题意是这样的 给定一个n*m的整数矩阵 n和m均小于1000 对这个矩阵删去任意行和列后剩余一个矩阵为M{x1,x2,,,,xm;y1,y2,,,,,yn}表示删除任意的M行N列 对于 ...
随机推荐
- oracle学习操作(1)
一.oracle表及表空间: 1.查看用户.用户表空间等,需要sysdba登陆: select username, default_tablespace from dba_users; 2.一个数 ...
- apply、call和bind
apply()和call() 虽然在一个独立的函数调用中,根据是否是strict模式,this指向undefined或window,不过,我们还是可以控制this的指向的!要指定函数的this指向哪个 ...
- SpringMVC中的重定向和转发的实现
1.请求转发和重定向的区别 请求重定向和请求转发都是web开发中资源跳转的方式. 请求转发是服务器内部的跳转 地址栏比发生变化 只有一个请求相应 可以通过request域对跳转目标的请求 请求重定向是 ...
- MyEclipse中复制web项目,部署之后访问报错
- [转]Serv-U 配置
- Monit安装与配置
Monit安装与配置 monit 监控并自动重启服务 官方文档
- scrapy 抓取拉勾网数据
其实很简单,却因为一些小问题,折腾不少时间,简要记录一下,以备后需. >> scrapy startproject lagou >> cd lagou >> scr ...
- python logging 日志模块的配置和使用
import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(filename)s[line:%(line ...
- dbms_xplan之display_cursor函数的使用
DBMS_XPLAN包中display_cursor函数不同于display函数,display_cursor用于显示SQL语句的真实的执行计划,在大多数情况下,显示真实的执行计划有助于更好的分析SQ ...
- ossim 4.1 安装
在这说明一下,本人也是第一次安装这东东很多我自己也不懂,只能把自己的安装步骤通过贴图呈现出来了!!!! 我用root用户登录的,顺便查看ip 在浏览器打开网址https://192.168.86.15 ...