A7802 | Codeforces World Finals
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
The king Copa often has been reported about the Codeforces site, which is rapidly getting more and more popular among the brightest minds of the humanity, who are using it for training and competing. Recently Copa understood that to conquer the world he needs to organize the world Codeforces tournament. He hopes that after it the brightest minds will become his subordinates, and the toughest part of conquering the world will be completed.
The final round of the Codeforces World Finals 20YY is scheduled for $DD$ . $MM$ . $YY$ , where $DD$ is the day of the round, $MM$ is the month and $YY$ are the last two digits of the year. Bob is lucky to be the first finalist form Berland. But there is one problem: according to the rules of the competition, all participants must be at least 18 years old at the moment of the finals. Bob was born on $BD$ . $BM$ . $BY$ . This date is recorded in his passport, the copy of which he has already mailed to the organizers. But Bob learned that in different countries the way, in which the dates are written, differs. For example, in the US the month is written first, then the day and finally the year. Bob wonders if it is possible to rearrange the numbers in his date of birth so that he will be at least 18 years old on the day $DD$ . $MM$ . $YY$ . He can always tell that in his motherland dates are written differently. Help him.
According to another strange rule, eligible participant must be born in the same century as the date of the finals. If the day of the finals is participant's 18-th birthday, he is allowed to participate.
As we are considering only the years from $2001$ to $2099$ for the year of the finals, use the following rule: the year is leap if it's number is divisible by four.
The final round of the Codeforces World Finals 20YY is scheduled for $DD$ . $MM$ . $YY$ , where $DD$ is the day of the round, $MM$ is the month and $YY$ are the last two digits of the year. Bob is lucky to be the first finalist form Berland. But there is one problem: according to the rules of the competition, all participants must be at least 18 years old at the moment of the finals. Bob was born on $BD$ . $BM$ . $BY$ . This date is recorded in his passport, the copy of which he has already mailed to the organizers. But Bob learned that in different countries the way, in which the dates are written, differs. For example, in the US the month is written first, then the day and finally the year. Bob wonders if it is possible to rearrange the numbers in his date of birth so that he will be at least 18 years old on the day $DD$ . $MM$ . $YY$ . He can always tell that in his motherland dates are written differently. Help him.
According to another strange rule, eligible participant must be born in the same century as the date of the finals. If the day of the finals is participant's 18-th birthday, he is allowed to participate.
As we are considering only the years from $2001$ to $2099$ for the year of the finals, use the following rule: the year is leap if it's number is divisible by four.
输入格式
The first line contains the date $DD$ . $MM$ . $YY$ , the second line contains the date $BD$ . $BM$ . $BY$ . It is guaranteed that both dates are correct, and $YY$ and $BY$ are always in $[01;99]$ .
It could be that by passport Bob was born after the finals. In this case, he can still change the order of numbers in date.
It could be that by passport Bob was born after the finals. In this case, he can still change the order of numbers in date.
输出格式
If it is possible to rearrange the numbers in the date of birth so that Bob will be at least 18 years old on the $DD$ . $MM$ . $YY$ , output YES. In the other case, output NO.
Each number contains exactly two digits and stands for day, month or year in a date. Note that it is permitted to rearrange only numbers, not digits.
Each number contains exactly two digits and stands for day, month or year in a date. Note that it is permitted to rearrange only numbers, not digits.
输入输出样例
输入 #1
01.01.98 01.01.80
输出 #1
YES
输入 #2
20.10.20 10.02.30
输出 #2
NO
输入 #3
28.02.74 28.02.64
输出 #3
NO
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted