标签:
Kennethsnow and Hlwt both
love football.
One day, Kennethsnow wants
to review the match in
penalty shootout. he fell asleep.
The next day, he asked Hlwt for
the result. Hlwt said that it scored
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
winner can be confirmed(i.e: no matter what happened after this shoot, the winner will not change), the match end immediately.
If after
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.
The only line contains Hlwt said.
Output a string Yes or No,
means whether the result is legal.
| Sample Input | Sample Output |
|---|---|
3 2 |
Yes |
2 5 |
No |
The Sample
The Sample
This story happened in a parallel universe. In this world where we live, kennethsnow is
a fan of Real Madrid.
#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;
}UESTC 1034 AC Milan VS Juventus 分情况讨论
标签:
原文地址:http://blog.csdn.net/prolightsfxjh/article/details/50936048