Codeforces 112B-Petya and Square(实现)
2 seconds
256 megabytes
standard input
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.
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 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(实现)的更多相关文章
- codeforces 112B Petya and Square
B. Petya and Square time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #448 C. Square Subsets
题目链接 Codeforces Round #448 C. Square Subsets 题解 质因数 *质因数 = 平方数,问题转化成求异或方程组解的个数 求出答案就是\(2^{自由元-1}\) , ...
- Codeforces 710C. Magic Odd Square n阶幻方
C. Magic Odd Square time limit per test:1 second memory limit per test:256 megabytes input:standard ...
- Codeforces 716C. Plus and Square Root-推公式的数学题
http://codeforces.com/problemset/problem/716/C codeforces716C. Plus and Square Root 这个题就是推,会推出来规律,发现 ...
- CodeForces 362E Petya and Pipes
Petya and Pipes Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. ...
- Codeforces 1187 F - Expected Square Beauty
F - Expected Square Beauty 思路:https://codeforces.com/blog/entry/68111 代码: #pragma GCC optimize(2) #p ...
- 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 ...
- codeforces B. Petya and Staircases 解题报告
题目链接:http://codeforces.com/problemset/problem/362/B 题目意思:给出整数n和m,表示有n级楼梯和m级dirty的楼梯,接下来m个数表示对应是哪一个数字 ...
- 【模拟】Codeforces 710C Magic Odd Square
题目链接: http://codeforces.com/problemset/problem/710/C 题目大意: 构造一个N*N的幻方.任意可行解. 幻方就是每一行,每一列,两条对角线的和都相等. ...
- Codeforces 890C - Petya and Catacombs 模拟
C. Petya and Catacombstime limit per test1 secondmemory limit per test256 megabytesinputstandard inp ...
随机推荐
- POJ 1734.Sightseeing trip (Floyd 最小环)
Floyd 最小环模板题 code /* floyd最小环,记录路径,时间复杂度O(n^3) 不能处理负环 */ #include <iostream> #include <cstr ...
- ios开发之UIImageView
废话少说,直接进入正题!!! 1.创建一个UIImageView: 创建一个UIImageView对象的几种方法: UIImageView *imageView1 = [[UIImageView al ...
- spring Mvc json返回json的日期格式问题
(一)输出json数据 springmvc中使用jackson-mapper-asl即可进行json输出,在配置上有几点: 1.使用mvc:annotation-driven 2.在依赖管理中添加ja ...
- 使用Raphael 画图(二) 扩展的图形 (javascript)
看这文章前,建议先看第一编文章<使用Raphael 画图(一) 基本图形 (javascript)>. 在Raphael基础上扩展的图形: 要运行该例子要引入附件的2个js包.(g.rap ...
- 10条PHP高级技巧
1.使用一个SQL注射备忘单 一个基本的原则就是,永远不要相信用户提交的数据. 另一个规则就是,在你发送或者存储数据时对它进行转义(escape). 可以总结为:filter input, escap ...
- arp欺骗
arp欺骗原理 某机器A要向主机B发送报文,会查询本地的ARP缓存表,找到B的IP地址对应的MAC地址后,就会进行数据传输.如果未找到,则广播A一个ARP请求报文(携带主机A的IP地址Ia——物理地址 ...
- windows2008 R2 安装wampserver
1. 在官网http://www.wampserver.com/下载,wampserver2.5; 2. 安装时候会缺少msvcr110.dll文件,所以先要安装这个文件: 3. 先从微软下载Visu ...
- arm-none-eabi-gcc install
Zephyr除了官方的编译工具,还有第三方工具 arm-none-eabi-gcc . This PPA is an alternative to toolchain released at http ...
- 最好用的手机编程软件-C4droid
Q:c4droid是什么? A:c4droid(以下简称c4)是安卓平台上最强大的c/c++ 编译器,你可以在手机上用手机编写自己的C/C++程序,并且可以把程序导出成apk文件. 下载地址:http ...
- Selenium 自动化验收测试
Web 应用程序的验收测试常常涉及一些手工任务,例如打开一个浏览器,并执行一个测试用例中所描述的操作.但是手工执行的任务容易出现操作人员人为的错误,也比较费时间.因此,尽可能将这些任务自动化,以消除人 ...