2013
12-09

# Number Steps

Starting from point (0,0) on a plane, we have written 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.

The first line of the input is N, the number of test cases for this problem. In each of the N following lines, there is x, and y representing the coordinates (x, y) of a point.

For each point in the input, write the number written at that point or write No Number if there is none.

3
4 2
6 6
3 4

6
12
No Number

2011-12-21 10:39:00

# include <stdio.h>

int gao(int x, int y)
{
int ans ;
if (x == y) return 2*x - (x&1) ;
return gao(x, y+2) - 2  ;
}

int main ()
{
int T, x, y ;
scanf ("%d", &T) ;
while (T--)
{
scanf ("%d%d", &x, &y) ;
if (x != y && x != y+2) printf ("No Number\n") ;
else printf ("%d\n", gao(x,y)) ;
}
return 0 ;
}

1. 博主您好，这是一个内容十分优秀的博客，而且界面也非常漂亮。但是为什么博客的响应速度这么慢，虽然博客的主机在国外，但是我开启VPN还是经常响应很久，再者打开某些页面经常会出现数据库连接出错的提示

2. 站长，你好！
你创办的的网站非常好，为我们学习算法练习编程提供了一个很好的平台，我想给你提个小建议，就是要能把每道题目的难度标出来就好了，这样我们学习起来会有一个循序渐进的过程！

3. 5.1处，反了；“上一个操作符的优先级比操作符ch的优先级大，或栈是空的就入栈。”如代码所述，应为“上一个操作符的优先级比操作符ch的优先级小，或栈是空的就入栈。”

4. #include <cstdio>

int main() {