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
The next day, he asked Hlwt
for the result. Hlwt
said that it scored a:b
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
- If after 5 turns the 2
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
3 2
2 5
Sample Output
Yes
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.
Source
The 13th UESTC Programming Contest Preliminary
//题意:输入a,b;
表示两个人在点球,a,b表示两个人的得分数
现在要求:
进行五局的比赛,没进一个球的一分,没进不得分,如果比赛已经分出胜负了,那么比赛就结束,后面的几轮就不用比了,现在问给定的a,b是否是正确。
//思路:
因为是问是否确定所以要逐个球比较。
#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;
}