B. Petya and Square
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

The first line contains three space-separated integers 2nx 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.

Output

If the square is possible to cut, print "YES", otherwise print "NO"
(without the quotes).

Sample test(s)
input
4 1 1
output
YES
input
2 2 2
output
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 long
char 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");
else
puts("YES");
} return 0;
}

Codeforces 112B-Petya and Square(实现)的更多相关文章

  1. codeforces 112B Petya and Square

    B. Petya and Square time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. Codeforces Round #448 C. Square Subsets

    题目链接 Codeforces Round #448 C. Square Subsets 题解 质因数 *质因数 = 平方数,问题转化成求异或方程组解的个数 求出答案就是\(2^{自由元-1}\) , ...

  3. Codeforces 710C. Magic Odd Square n阶幻方

    C. Magic Odd Square time limit per test:1 second memory limit per test:256 megabytes input:standard ...

  4. Codeforces 716C. Plus and Square Root-推公式的数学题

    http://codeforces.com/problemset/problem/716/C codeforces716C. Plus and Square Root 这个题就是推,会推出来规律,发现 ...

  5. CodeForces 362E Petya and Pipes

    Petya and Pipes Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. ...

  6. Codeforces 1187 F - Expected Square Beauty

    F - Expected Square Beauty 思路:https://codeforces.com/blog/entry/68111 代码: #pragma GCC optimize(2) #p ...

  7. Codeforces 715A. Plus and Square Root[数学构造]

    A. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  8. codeforces B. Petya and Staircases 解题报告

    题目链接:http://codeforces.com/problemset/problem/362/B 题目意思:给出整数n和m,表示有n级楼梯和m级dirty的楼梯,接下来m个数表示对应是哪一个数字 ...

  9. 【模拟】Codeforces 710C Magic Odd Square

    题目链接: http://codeforces.com/problemset/problem/710/C 题目大意: 构造一个N*N的幻方.任意可行解. 幻方就是每一行,每一列,两条对角线的和都相等. ...

  10. Codeforces 890C - Petya and Catacombs 模拟

    C. Petya and Catacombstime limit per test1 secondmemory limit per test256 megabytesinputstandard inp ...

随机推荐

  1. 【HDU4391】【块状链表】Paint The Wall

    Problem Description As a amateur artist, Xenocide loves painting the wall. The wall can be considere ...

  2. javascript——面向对象程序设计(2)

    <script type="text/javascript"> //1.理解原型对象 //2.原型与in操作符 //3.更简单的原型语法 //4.原型的动态性 //5. ...

  3. EasyUI 1.3之前DataGrid中动态选中、获取Checkbox

    这几天做项目,由于项目中用到的EasyUI版本过低,不能使用自带操作DataGrid中CheckBox的方法. 所以自己写了一个临时方案: 根据ID集合选中所属行的CheckBox: data={1, ...

  4. jquery元素查找方法集锦

    jQuery常用的元素查找方法总结 $("#myELement")    选择id值等于myElement的元素,id值不能重复在文档中只能有一个id值是myElement所以得到 ...

  5. 通过Java代码浅谈HTTP协议

    最近刚看了http协议,想写点东西加深一下理解,如果哪儿写错了,请指正. 1 介绍 HTTP是Hyper Text Transfer Protocol(超文本传输协议)的缩写.它的发展是万维网协会(W ...

  6. 快速傅里叶变换(FFT)

    一.FFT的意义 DFT虽然实现了FT的计算机计算,但是计算量大,不适合实时的数字信号处理.FFT算法的出现,使DFT的计算效率更高,速度更快. 二.FFT与DFT的关系 从FT到DFT经过了数字角频 ...

  7. gridview checkbox从服务器端和客户端两个方面实现全选和反选

    GridView中的checkbox的全选和反选在很多的地方都是要求实现的,所以下面就从服务器端和客户端两个方面实现了checkbox的选择,感兴趣的朋友可以了解下,希望本文对你有所帮助 GridVi ...

  8. 关于Unity导出的Android应用在小米、联想等机型上崩溃的问题

    应用在三星手机上运行没有出现问题,但在小米和联想手机上会崩溃.这个问题在刚开始时一直查不到问题所在,后来发现是因为Android清单文件中声明的权限出现了重复,去掉了重复的权限之后,就没有出现崩溃的情 ...

  9. 工作总结:VS2010/MFC编程入门之十六(对话框:消息对话框)

    原文地址:http://www.jizhuomi.com/software/171.html 我们在使用Windows系统的过程中经常会见到消息对话框,提示我们有异常发生或提出询问等.因为在软件开发中 ...

  10. BZOJ 1033 杀蚂蚁

    Description 最近,佳佳迷上了一款好玩的小游戏:antbuster.游戏规则非常简单:在一张地图上,左上角是蚂蚁窝,右下角是蛋糕,蚂蚁会源源不断地从窝里爬出来,试图把蛋糕搬回蚂蚁窝.而你的任 ...