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列 对于 ...
随机推荐
- 实验三:C分支结构程序设计
3.1 #include<stdio.h> int main(){ char a; scanf("%c",&a); if(a>=65&&a ...
- 发邮件 文字+ 附件的方法(QQ or 网易 邮箱)
#coding:utf-8import smtplibfrom email.mime.text import MIMETextfrom email.mime.multipart import MIME ...
- 【费马小定理+快速幂取模】ACM-ICPC 2018 焦作赛区网络预赛 G. Give Candies
G. Give Candies There are N children in kindergarten. Miss Li bought them N candies. To make the pro ...
- ASP.NET Web Pages:对象
ylbtech-.Net-ASP.NET Web Pages:对象 1.返回顶部 1. ASP.NET Web Pages - 对象 Web Pages 经常是跟对象有关的. Page 对象 您已经看 ...
- TOM带你玩充电 篇三:15款5号电池横评及选购建议——南孚金霸王小米宜家耐时品胜一个都逃不了
双鹿电池的几个版本 理论上来说性价比:绿骑士>金骑士>黑骑士>蓝骑士 绿骑士和金骑士都很不错.哪个便宜买哪个. 小米性价比虽然最高,但是超市买不到. 蓝骑士是普通碳性电池,黑骑士是高 ...
- How to use POST method in Tornado?
http://stackoverflow.com/questions/10367981/how-to-use-post-method-in-tornado
- JavaScript中的数组和字符串
知识内容: 1.JavaScript中的数组 2.JavaScript中的字符串 一.JavaScript中的数组 1.JavaScript中的数组是什么 数组指的是数据的有序列表,每种语言基本上都有 ...
- Python Twisted系列教程1:Twisted理论基础
作者:dave@http://krondo.com/in-which-we-begin-at-the-beginning/ 译者:杨晓伟(采用意译) 前言: 最近有人在Twisted邮件列表中提出诸 ...
- Mysql-事务,原子性操作
事物分为 自动(默认的)和手动(需开启事务)两种 -- 事务 start transaction; -- commite; 提交事务 -- rollback; 回滚事务 create table if ...
- 0_Simple__simplePrintf
在设备代码中使用函数 printf(),没有新的认识. ▶ 源代码 #include <stdio.h> #include <cuda_runtime.h> #include ...