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-app开发接口加密
自己平时工作中用到的一套接口加密规则,记录下来以后用: /** 2 inc 3 解析接口 客户端接口传输规则: 1.用cmd参数(base64)来动态调用不同的接口,接口地址统一为 http://a. ...
- web_profile(网站分析)配置
web_profiler: # DEPRECATED, it is not useful anymore and can be removed # safely from your configura ...
- ZendFramework2 文件结构
Application |__ config // 配置文件目录 |__ language // 语言包目录 |__ src |__ Application |__ Controller // 控制器 ...
- 无法添加sql server ER图
Database diagram support objects cannot be installed because this database does not have a valid own ...
- sql helper
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.C ...
- ExtJs Model之convert的使用
convert: function(value,record){} value:为当前属性的值,record.get('属性')用来获取其他属性的值. 以下案例是:将年龄减去2. Ext.define ...
- 仿新浪微博短网址PHP实现方案
微博限制140字,但是我们知道有时需要分享一个类似淘宝商品的链接,很长,为了避免这个问题,所有了短网址的概念,废话不多说,直接把我的实现方案分享一下: 1)将长网址md5生成32位签名串,分为4段, ...
- 51 EEPROM操作模板
各个型号容量及扇区请查datasheet #include <reg52.h> #include "intrins.h" typedef unsigned char b ...
- c3p0链接池
频繁的链接数据库是非常消耗性能的,所以就采用了将一定量的链接保存在一个池中,这个池我们叫做链接池. 详细请看:http://baike.baidu.com/link?url=dlTW-fTS3N_-j ...
- 2.9 Model Selection and the Bias–Variance Tradeoff
结论 模型复杂度↑Bias↓Variance↓ 例子 $y_i=f(x_i)+\epsilon_i,E(\epsilon_i)=0,Var(\epsilon_i)=\sigma^2$ 使用knn做预测 ...