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
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
5 turns, in each turn,2 teams each should take a penalty shoot. If goal, the team get1 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 the2 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 Hlwt
said.
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
The Sample
This story happened in a parallel universe. In this world where we live, kennethsnow
is
a fan of Real Madrid.
Source
My Solution
#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!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架