POJ 1663:Number Steps
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 13664 | Accepted: 7378 |
Description

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.
Input
Output
Sample Input
3
4 2
6 6
3 4
Sample Output
6
12
No Number
洪水题,找规律。
代码:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std; int main()
{
//freopen("i.txt","r",stdin);
//freopen("o.txt","w",stdout); int Test,x,y;
cin>>Test; while(Test--)
{
cin>>x>>y;
if((x==y||x-2==y)&&x>=0&&y>=0)
{
if(x==y)
{
if(x%2)
{
cout<<x*2-1<<endl;
}
else
{
cout<<x*2<<endl;
}
}
else
{
if(x%2)
{
cout<<x*2-3<<endl;
}
else
{
cout<<x*2-2<<endl;
}
}
}
else
{
cout<<"No Number"<<endl;
}
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
POJ 1663:Number Steps的更多相关文章
- POJ 1019:Number Sequence 二分查找
Number Sequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 36013 Accepted: 10409 ...
- 九度OJ 1136:Number Steps(步数) (基础题)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:691 解决:412 题目描述: Starting from point (0,0) on a plane, we have written ...
- POJ 1663:Number Steps
Number Steps Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13758 Accepted: 7430 Des ...
- poj 2104 K-th Number 主席树+超级详细解释
poj 2104 K-th Number 主席树+超级详细解释 传送门:K-th Number 题目大意:给出一段数列,让你求[L,R]区间内第几大的数字! 在这里先介绍一下主席树! 如果想了解什么是 ...
- POJ 3252:Round Numbers
POJ 3252:Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10099 Accepted: 36 ...
- 原生JS:Number对象详解
Number对象 本文参考MDN做的详细整理,方便大家参考MDN JavaScript 的 Number 对象是经过封装的能让你处理数字值的对象.Number 对象由 Number() 构造器创建. ...
- HDU-1391 Number Steps
http://acm.hdu.edu.cn/showproblem.php?pid=1391 Number Steps Time Limit: 2000/1000 MS (Java/Others) ...
- Number Steps
Number Steps Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- JavaScript:Number 对象
ylbtech-JavaScript:Number 对象 1. Number 对象返回顶部 Number 对象 Number 对象是原始数值的包装对象. 创建 Number 对象的语法: var my ...
随机推荐
- day06-Python运维开发基础(字符串格式化与相关的函数、列表相关的操作)
1. 字符串相关的操作与格式化 # ### 字符串相关操作 # (1)字符串的拼接 + var1 = "亲爱的," var2 = "男孩" res = var1 ...
- linux 查看ip、用户、时间对应执行的命令
这个需要使用到history命令.可以加数字,返回最近执行的几条命令.如果不加数字会返回所有的历史命令. [root@localhost ~]# history 20 1015 rm stdin.lo ...
- PHP mb_substr mbstring 函数
定义和用法 mb_substr - 获取部分字符串 版本支持 PHP4 PHP5 PHP7 支持 支持 支持 5.4.8 length 传入 NULL,则从 start 提取到字符串的结尾处. 在之前 ...
- 解决d7在更高版本上运行乱码问题,或者是调用更高版本的dll
将String类型改成WideString类型即可
- 关于js中异步问题的解决方案
在js中有一个始终无法绕过的问题,如何优雅地解决异步问题.实际上,js在执行过程中,每遇到一个异步函数,都会将这个异步函数放入一个异步队列中,只有当同步线程执行结束之后,才会开始执行异步队列中的函数, ...
- 抓包工具fiddler的Https证书设置
一.工具(option)--设置(setting)-- https-- 动作(actions)-- (open windows certificate manger)-- 搜索(fiddler)删除所 ...
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 辅助类:响应式实用工具
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- Acwing198 反素数
原题面:https://www.acwing.com/problem/content/200/ 题目大意:对于任何正整数x,其约数的个数记作g(x),例如g(1)=1.g(6)=4.如果某个正整数x满 ...
- 无法执行 BACKUP LOG,因为当前没有数据库备份,导入数据库备份.bak文件
右键数据库——>任务——>还原——>数据库 无法执行 BACKUP LOG,因为当前没有数据库备份 结尾日志的问题 还原选择中去掉结尾日志就可以了
- Windows 10中使用VirtualBox
新版Windows 10或者安装了新的更新以后,VirtualBox虚拟机就不能用了. 原因是WIndows10里面有个叫Virtualization-base security的安全机制打开了. 关 ...