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 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.

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
Note

A sample test from the statement and one of the possible ways of cutting the square are shown in the picture:

算法分析:从红色区域 往外扩展,红色区域的上下左右,加上左上、右上、左下、右下,总共8块区域(前提是 最多存在8个),这些区域最重要划分到两个大区域中的一个。现在如果红色块在版图的中间线上下,肯定不能划分开的。

#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <iomanip>
#include <algorithm> using namespace std; int main()
{
int n,x,y;
int i, j;
while( cin>>n>>x>>y )
{
int dd=n/2;
if( (x==dd||x==dd+1)&&(y==dd||y==dd+1) )
cout<<"NO\n";
else
cout<<"YES\n";
}
return 0;
}

codeforces 112B Petya and Square的更多相关文章

  1. Codeforces Round #448 C. Square Subsets

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

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

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

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

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

  4. CodeForces 362E Petya and Pipes

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

  5. Codeforces 1187 F - Expected Square Beauty

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

  6. 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 ...

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

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

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

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

  9. Codeforces 890C - Petya and Catacombs 模拟

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

随机推荐

  1. struts2.16中文乱码问题解决

    方法1.在struts.xml文件中添加<constant name="struts.i18n.encoding" value="GBK" /> 方 ...

  2. sprinvmvc整合swagger实现实时接口信息展示

    1.pom.xml引入swagger插件 <dependency> <groupId>io.springfox</groupId> <artifactId&g ...

  3. 【前端阅读】——《JavaScript应用开发技术详解指南》摘记&思维导图

    读这本书,我主要关注三个部分:JavaScript内置函数,程序调试以及Ajax基础.由于多是介绍基本概念,所以,采用思维导图的方式,做了一个梳理,以下就是精简的主要内容. 注:转载请注明出处

  4. 【温故知新】——HTML基础重要知识点复习

    前言:本文是自己在学习课程中的课程笔记,这里用来温故知新的,并非本人原创. 一.HTML快速入门(重点) 1.HTML概述 1.什么是HTML HTML : Hyper Text Markup Lan ...

  5. linux中sed中用s 替换中遇到的问题

    sed替换时候不能用-n,只输出替换的行,为什么???? 比如: sed "2,4s/\"//g" /var/lib/status     #可以输出 但是: sed - ...

  6. PS中混合模式是什么意思?

      PS中图层混合模式中的溶解,变暗,正片叠底,颜色加深,线性加深,叠加,柔光,亮光,强光,线性光,点光,实色混合,差值,排除,色相,饱和度,颜色,亮度各是什么原理?   Normal 正常模式,也是 ...

  7. firework压缩图片类似于GD库中压缩图片的思路

    1.先建一张空白图片, 2.再把需要压缩的图片拖上去, 3.符合画布 4.调到需要的大小

  8. 对‘TIFFReadDirectory@LIBTIFF_4.0’未定义的引用-------------- 解决办法

    ABLE_DEPRECATED' is defined [-Winvalid-pch] //usr/lib/libvtkIO.so.5.10:对‘TIFFReadDirectory@LIBTIFF_4 ...

  9. php开启pathinfo 模式

    pathinfo 模式 需要 php.ini 开启下面这个参数 cgi.fix_pathinfo=1 path_info模式:http://www.xxx.com/index.php/模块/方法   ...

  10. C#的类型列表

    以下是 C# 内建类型的列表: 类型 字节 描述 unsigned byte signed byte signed short unsigned short signed integer unsign ...