Number Steps
Number Steps
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4482 Accepted Submission(s):
2732
all non-negative integers 0, 1, 2,... as shown in the figure. For example, 1, 2,
and 3 has been written at points (1,1), (2,0), and (3, 1) respectively and this
pattern has continued.

You are to write a
program that reads the coordinates of a point (x, y), and writes the number (if
any) that has been written at that point. (x, y) coordinates in the input are in
the range 0...5000.
cases for this problem. In each of the N following lines, there is x, and y
representing the coordinates (x, y) of a point.
at that point or write No Number if there is none.
12
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int x,y;
int T;
cin>>T;
while(T--)
{
cin>>x>>y;
if(x-y==||x-y==)
{
if(x-y==)
{
if(x%==)
cout<<*x<<endl;
else
cout<<*x-<<endl;
}
else
{
if(x%==)
cout<<x+y<<endl;
else
cout<<x+y-<<endl;
}
}
else
printf("No Number\n");
}
}
Number Steps的更多相关文章
- HDU-1391 Number Steps
http://acm.hdu.edu.cn/showproblem.php?pid=1391 Number Steps Time Limit: 2000/1000 MS (Java/Others) ...
- ZOJ 1414:Number Steps
Number Steps Time Limit: 2 Seconds Memory Limit: 65536 KB Starting from point (0,0) on a plane, ...
- POJ 1663:Number Steps
Number Steps Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13758 Accepted: 7430 Des ...
- POJ 1663:Number Steps
Number Steps Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13664 Accepted: 7378 Des ...
- HDOJ 1391 Number Steps(打表DP)
Problem Description Starting from point (0,0) on a plane, we have written all non-negative integers ...
- hdu1391(Number Steps )
Problem Description Starting from point (0,0) on a plane, we have written all non-negative integers ...
- HDU 1391 number steps(找规律,数学)
Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2,... as shown ...
- 九度OJ 1136:Number Steps(步数) (基础题)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:691 解决:412 题目描述: Starting from point (0,0) on a plane, we have written ...
- hdu 1391 Number Steps(规律)
题意:找规律 思路:找规律 #include<iostream> #include<stdio.h> using namespace std; int main(){ int ...
随机推荐
- 用PHP向MySql中写入图片
我们经常遇到的问题是如何将图片文件放到Mysql数据库当中,这样可以避免没有认证的用户找到我们的图片资源! 1.看看数据库里的表结构怎么写 CREATE TABLE Images ( PicN ...
- Android基础学习之context
Context既是环境变量,也是句柄(handler),也是上下文.类似用使用工具的工具,比如写字来说,笔是工具,Context可以看成是手,用来使用笔.context具有唯一性,具有很多种行为(定义 ...
- eclipse 使用mvn模块化开发
1.创建maven父工程步骤:new-->other-->选择maven project-->next-->勾选create a simple project-->nex ...
- NFC应用(一)卡应用
门禁卡.停车卡.公交卡工作于NFC的卡模式,是目前日常生活中接触得最多的NFC应用场合.一张小小的卡片,轻触读卡器使可开门禁锁.进出停车场.支付车资,即快捷方便,又安全,易于管理. 以门禁系统为例,通 ...
- Ice笔记-利用Ice::Application类简化Ice应用
Ice笔记-利用Ice::Application类简化Ice应用 作者:ydogg,转载请申明. 在编写Ice相关应用时,无论是Client还是Server端,都必须进行一些必要的动作,如:Ice通信 ...
- 【C++基础之十四】函参的缺省
可能会有这么一个函数,在大部分的情况下,我们不用给它传递参数,但在某些特殊情况下,我们需要给它传递参数,那怎么办呢? 简单啊,写两个一样的方法,一个带参,一个不带参... 这样也太没水准了.来点高端的 ...
- HINTERNET 句柄
这篇文章的内容能够简单总结例如以下: WinINet函数创建和使用类型为HINTERNET的句柄 HINTERNET句柄不能与其它类型的句柄互换使用 用InternetCloseHandle关闭HIN ...
- Hadoop中SequenceFile的使用
1.对于某些应用而言,须要特殊的数据结构来存储自己的数据. 对于基于MapReduce的数据处理.将每一个二进制数据的大对象融入自己的文件里并不能实现非常高的可扩展性,针对上述情况,Hadoop开发了 ...
- 【输入输出挂】【Uva11462】Age Sort
例题17 年龄排序(Age Sort, UVa 11462)照从小到大的顺序输出. [输入格式] 输入包含多组测试数据.每组数据的第一行为整数n(0<n≤2 000 000),即居民总数:下一 ...
- apache 日志中记录代理IP以及真实客户端IP
vim /usr/local/apach2/conf/httpd.conf 默认情况下log日志格式为:LogFormat "%h %l %u %t \"%r\" %&g ...