A8186 | Petya and Square
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Little Petya loves playing with squares. Mum bought him a square $2n×2n$ in size. Petya marked a cell inside the square and now he is solving the following task.
The task is to draw a broken line that would go along the grid lines and that would cut the square into two equal parts. The cutting line should not have any common points with the marked cell and the resulting two parts should be equal up to rotation.
Petya wants to determine whether it is possible to cut the square in the required manner given the sizes of the square side and the coordinates of the marked cell. Help him.
The task is to draw a broken line that would go along the grid lines and that would cut the square into two equal parts. The cutting line should not have any common points with the marked cell and the resulting two parts should be equal up to rotation.
Petya wants to determine whether it is possible to cut the square in the required manner given the sizes of the square side and the coordinates of the marked cell. Help him.
输入格式
The first line contains three space-separated integers $2n$ , $x$ and $y$ ( $2<=2n<=100,1<=x,y<=2n$ ), representing the length of a square's side and the coordinates of the marked cell. It is guaranteed that $2n$ is even.
The coordinates of the marked cell are represented by a pair of numbers $x$ $y$ , where $x$ represents the number of the row and $y$ represents the number of the column. The rows and columns are numbered by consecutive integers from $1$ to $2n$ . The rows are numbered from top to bottom and the columns are numbered from the left to the right.
The coordinates of the marked cell are represented by a pair of numbers $x$ $y$ , where $x$ represents the number of the row and $y$ represents the number of the column. The rows and columns are numbered by consecutive integers from $1$ to $2n$ . The rows are numbered from top to bottom and the columns are numbered from the left to the right.
输出格式
If the square is possible to cut, print "YES", otherwise print "NO" (without the quotes).
输入输出样例
输入 #1
4 1 1
输出 #1
YES
输入 #2
2 2 2
输出 #2
NO
A sample test from the statement and one of the possible ways of cutting the square are shown in the picture:


C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted