当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6253:Knightmare

题目描述
A knight jumps around an infinite chessboard. The chessboard is an unexplored territory. In the spirit of explorers, whoever stands on a square for the first time claims the ownership of this square. The knight initially owns the square he stands, and jumps $N$ times before he gets bored.
Recall that a knight can jump in 8 directions. Each direction consists of two squares forward and then one squaure sidways.

After $N$ jumps, how many squares can possibly be claimed as territory of the knight? As $N$ can be really large, this becomes a nightmare to the knight who is not very good at math. Can you help to answer this question?
输入解释
The first line of the input gives the number of test cases, $T$. $T$ test cases follow.
Each test case contains only one number $N$, indicating how many times the knight jumps.
$1 \leq T \leq 10^5$
$0 \leq N \leq 10^9$
输出解释
For each test case, output one line containing “Case #x: y”, where $x$ is the test case number (starting from 1) and $y$ is the number of squares that can possibly be claimed by the knight.
输入样例
3
0
1
7
输出样例
Case #1: 1
Case #2: 9
Case #3: 649
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6253

最后修改于 2020-10-25T23:29:43+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)