AC Milan VS Juventus(模拟)

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 20032003 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 aa:bb 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 55 turns, in each turn, 22 teams each should take a penalty shoot. If goal, the team get 11 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 55 turns the 22 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 22 integers aa, bb. Means the result that Hlwt said.

0≤a,b≤100≤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 11 is the actual result of the match in 20032003.

The Sample 22, when it is 22:44 after 44 turns, AC Milan can score at most 11 point in the next turn. So Juventus has win when it is 22:44. 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.

题解:两个队投球,进了得1分,当一个队必胜的时候可以不用打了;现在给出得分判断是否合理;

代码:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
bool work(int a, int b){
    if(a == b)
        return false;
    if(a > 5 || b > 5){
        if(abs(a - b) == 1)
            return true;
        else
            return false;
    }
    if(a == 5 || b == 5){
        if(b < 3 || a < 3)
            return false;
        else
            return true;
    }
    if(a == 4 || b == 4){
        if(a == 0 || b == 0)
            return false;
        else
            return true;
    }
    if(a == 3 || b == 3){
        return true;
    }
    return true;
}
int main(){
    int a, b;
    while(~scanf("%d%d", &a, &b)){
        if(work(a, b))
            puts("Yes");
        else
            puts("No");
    }
    return 0;
}
时间: 2024-10-29 19:07:54

AC Milan VS Juventus(模拟)的相关文章

UESTC 1034 AC Milan VS Juventus 分情况讨论

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 20032003 between AC Milan and Juventus

周赛题

UESTC - 1034 AC Milan VS Juventus Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %lld & %llu SubmitStatus Description Kennethsnow and Hlwt both love football. One day, Kennethsnow wants to review the match in 2003 between AC Milan and

HDU2074 叠筐(模拟问题)

Problem Description http://acm.hdu.edu.cn/showproblem.php?pid=2074 需要的时候,就把一个个大小差一圈的筐叠上去,使得从上往下看时,边筐花色交错.这个工作现在要让计算机来完成,得看你的了. Input 输入是一个个的三元组,分别是,外筐尺寸n(n为满足0<n<80的奇整数),中心花色字符,外筐花色字符,后二者都为ASCII可见字符: Output 输出叠在一起的筐图案,中心花色与外筐花色字符从内层起交错相叠,多筐相叠时,最外筐的角

8.22 今日头条笔试

这次套路深啊,怎么还有改错题!. 上来看题,每个题目的输入数据都很大,果断上scanf,printf, 千万不能用cin,cout 1. 右上角的点,我的思路是先对每一行去重(题目好像说没有重的点耶!),每一行只有最右边的点才是候选点,然后对这些候选点按照y坐标,从大到小访问,要求相应的x是严格递增的,最后打印输出. 1 #include<bits/stdc++.h> 2 #define pb push_back 3 typedef long long ll; 4 using namespac

4650 破损的键盘

4650 破损的键盘 时间限制: 1 s 空间限制: 16000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description 有一天,你需要打一份文件,但是你的键盘坏了,上面的"home"键和"end"键会时不时地按下,而你却毫不知情,甚至你都懒得打开显示器,当你打开显示器之后,出现在你的面前的是一段悲剧的文本. 输入描述 Input Description 输入只有一行,即这份文件,这份文件只包含小写字母和'['以及']',用'['代替"

10317 Fans of Footbal Teams

10317 Fans of Footbal Teams 时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: G++;GCC Description Two famous football teams, named AC Milan(AC米兰) and Inter Milan(国际米兰) will have a match in GuangZhou City, which is exciting. So a lot of fans get tog

10317 Fans of Footbal Teams(并查集)

10317 Fans of Footbal Teams 时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: G++;GCC Description Two famous football teams, named AC Milan(AC米兰) and Inter Milan(国际米兰) will have a match in GuangZhou City, which is exciting. So a lot of fans get tog

丢弃重口味的xml配置--spring4用groovy配置bean(转)

spring4之前,bean的配置可以主要分为两种方式,一种是使用基于xml,个人非常讨厌这种方式,因为明明一件很简单的事,放在xml中就会多了不少繁杂的信息.另一种方式,是从spring3.0开始,spring提供了是基于java的配置,相比于xml的配置方式,看起来会好一点儿.而在几天前release的spring4.0中,我们可以用groovy作为spring的配置文件啦!比起最早的基于xml配置,使用groovy会更加灵活,而且干扰信息会更少.比起基于java的配置,groovy配置还要

hdu4505 小Q系列故事——电梯里的爱情(水题)

Problem Description http://acm.hdu.edu.cn/showproblem.php?pid=4505 细心的同事发现,小Q最近喜欢乘电梯上上下下,究其原因,也许只有小Q自己知道:在电梯里经常可以遇到他心中的女神HR. 电梯其实是个很暧昧的地方,只有在电梯里,小Q才有勇气如此近距离接近女神,虽然觉得有点不自在,但次数多了,女神也习惯了小Q的存在,甚至熟悉到仿佛不说上句话自己也都觉得不合适了.可是,他们的谈话也仅仅限于今天天气不错啊或是你吃了吗之类的,往往在对方微笑点