Codeforces 112B-Petya and Square(实现)
来源:互联网 发布:亚马逊第三方软件 编辑:程序博客网 时间:2024/06/09 18:29
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 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.
If the square is possible to cut, print "YES", otherwise print "NO" (without the quotes).
4 1 1
YES
2 2 2
NO
题意 :有一块2n*2n的地板,在地板上有一个东西,给出坐标和地板的边长,现在要将地板切成相等的两部分,且不能切到那个东西,问能不能切成功。
只要在中间一定不能切。。反之则可
#include <iostream>#include <algorithm>#include <cstring>#include <cstdio>#include <cctype>#include <cstdlib>#include <set>#include <map>#include <vector>#include <string>#include <queue>#include <stack>#include <cmath>using namespace std;const int INF = 0x3f3f3f3f;#define LL long longchar s[1000000];int main(){int n,x,y;while(~scanf("%d%d%d",&n,&x,&y)){int tx=n/2,ty=n/2;if((x==tx||x==tx+1)&&(y==ty||y==ty+1))puts("NO");elseputs("YES");}return 0;}
- Codeforces 112B-Petya and Square(实现)
- B. Petya and Square
- codeforces B. Petya and Exam (模拟)
- Codeforces 112A-Petya and Strings(实现)
- CodeForces 66B Petya and Countryside (枚举)
- Codeforces 66B:Petya and Countryside(水题)
- Codeforces 832-B Petya and Exam (模拟)
- Petya and Square
- Codeforces 362B Petya and Staircases
- CodeForces 111B - Petya and Divisors
- CodeForces 111B Petya and Divisors
- CodeForces 362B Petya and Staircases
- 【CodeForces】[66B]Petya and Countryside
- CodeForces 362B Petya and Staircases
- CodeForces 66B - Petya and Countryside(水题)
- Codeforces 362B. Petya and Staircases
- CodeForces 832B Petya and Exam
- codeforces 832B (Petya and Exam)
- 如何使用Git从Github中下载代码
- 对计算机专业的认识
- 第七周阶乘
- sql查询in包含null的情况
- 控制台编程相关API 及相关编程
- Codeforces 112B-Petya and Square(实现)
- 飘逸的python - 实现一个pretty函数漂亮的输出嵌套字典
- 学习vi和vim编辑器(1):vi文本编辑器
- 求解集合的交集问题
- Java解析文件内容
- [概率dp] zoj 3822 Domination
- Android 判断程序是不是第一次运行
- TCP/IP协议分析--ARP包
- Codeforces 113A-Grammar Lessons(实现)