AC Milan VS Juventus

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)
Submit 
Status

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 1point
in the next turn. So Juventus has win when it is 2:4.
So the result cannot be 22:55.

This story happened in a parallel universe. In this world where we live, kennethsnow is
a fan of Real Madrid.

Source

The 13th UESTC Programming Contest Preliminary
The question is from here.

My Solution

分情况讨论清楚就好。然后注意 a == b 的时候也是No
把分类出来的区间理清楚。不要条件里面混杂着不该包括的东西

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std; int main()
{
int a, b;
scanf("%d%d", &a, &b);
if(a == b )printf("No");
else if((a == 5 && b <5) || (b == 5&& a <5)) {if(abs(a-b) >= 3) printf("No");else printf("Yes"); } //!!
else if(a < 5 && b <5) {if(abs(a-b) >= 4) printf("No");else printf("Yes"); }
else {if(abs(a-b) > 1) printf("No");else printf("Yes"); }
return 0;
}

Thank you all!

UESTC 1034 AC Milan VS Juventus 分情况讨论的更多相关文章

  1. 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/Oth ...

  2. AC Milan VS Juventus(模拟)

    AC Milan VS Juventus Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Oth ...

  3. HNU 12833 Omar’s Bug(分情况讨论)

    题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12833&courseid=268 解题报告:有个11个 ...

  4. bzoj 1067 分情况讨论

    这道题考察人的严谨,各种情况分类讨论. #include <cstdio> #include <algorithm> #include <map> #define ...

  5. Valid Number——分情况讨论最经典的题(没细看)——这题必须静下心来好好看看

    Validate if a given string is numeric. Some examples: "0" => true " 0.1 " =&g ...

  6. bzoj2756: [SCOI2012]奇怪的游戏(网络流+分情况)

    2756: [SCOI2012]奇怪的游戏 题目:传送门 题解: 发现做不出来的大难题一点一个网络流 %大佬 首先黑白染色(原来是套路...)染色之后就可以保证每次操作都一定会使黑白各一个各自的值加1 ...

  7. HDU6444(子段和、分情况比较)

    要点 不难想到gcd一下然后枚举每个开头走一圈,并记录一下数值. 最终答案是分情况的:1.能走几圈走几圈然后加上最后剩余的最大子段和:2.也可能是最后一圈后面的拖后腿了,所以最后一圈没走完就停,即长度 ...

  8. CONTINUE...?模拟分情况

    CONTINUE...? DreamGrid has  classmates numbered from  to . Some of them are boys and the others are ...

  9. HDU 2577 分情况多维DP

    How to Type Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

随机推荐

  1. 019 python面相对象编程

    一:self的意思 1.说明 self代表类的实例,而非类. 类的方法与普通的函数只有一个特别的区别——它们必须有一个额外的第一个参数名称, 按照惯例它的名称是 self. self 代表的是类的实例 ...

  2. 20165235 祁瑛 2018-4 《Java程序设计》第七周学习总结

    20165235 祁瑛 2018-4 <Java程序设计>第七周学习总结 教材学习内容总结 MySQL数据管理系统 MySQL数据管理系统,简称MySQL,是世界上流行的数据管理系统. M ...

  3. day60 pymysql

    预知扩展内容,详见地址如下(关于数据库备份和恢复) http://www.cnblogs.com/linhaifeng/articles/7525619.html 我们一般写程序都是在py文件里面,那 ...

  4. window.open 和showModalDialog的返回值

    方法: 1:  在父级页面 test.aspx 的点击<input type="button" id="btnShow" onclick="sh ...

  5. 使用 PySide2 开发 Maya 插件系列一:QT Designer 设计GUI, pyside-uic 把 .ui 文件转为 .py 文件

    使用 PySide2 开发 Maya 插件系列一:QT Designer 设计GUI, pyside-uic 把 .ui 文件转为 .py 文件 前期准备: 安装 python:https://www ...

  6. Ubuntu ssh-keygen 生成公钥并添加到远程服务器上

    1. 在本地生成公钥, ssh-keygen -t RSA -b 800 2. cd /root/.ssh 3. ssh-copy-id -i  id_rsa.pub 远程服务器IP 这一步需要输入远 ...

  7. Java反射之基础概念

    0.实例准备 package com.blueStarWei.invoke; public class Student { private String name; public Student() ...

  8. P3810 -三维偏序(陌上花开)cdq-分治

    P3810 [模板]三维偏序(陌上花开) 思路 :按照 1维排序 二维 分治三维树状数组维护 #include<bits/stdc++.h> using namespace std; #d ...

  9. linux 学习笔记 APACHE安装总结

    #cd /usr/local #mkdir APACHE #tar zxvf /usr/etc/DEV/httpd-2.2.9.tar.gz #mv httpd-2.2.9/* . #rm -rf h ...

  10. BZOJ.4446.[SCOI2015]小凸玩密室(树形DP)

    BZOJ LOJ 洛谷 (下面点亮一个灯泡就说成染色了,感觉染色比较顺口... 注意完全二叉树\(\neq\)满二叉树,点亮第一个灯泡\(\neq\)第一次点亮一号灯泡,根节点应该就是\(1\)... ...