CF715A.Plus and Square Root
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '
' (square root). Initially, the number 2 is displayed on the screen. There are n + 1 levels in the game and ZS the Coder start at the level 1.
When ZS the Coder is at level k, he can :
- Press the ' + ' button. This increases the number on the screen by exactly k. So, if the number on the screen was x, it becomes x + k.
- Press the '
' button. Let the number on the screen be x. After pressing this button, the number becomes
. After that, ZS the Coder levels up, so his current level becomes k + 1. This button can only be pressed when x is a perfect square, i.e. x = _m_2 for some positive integer m.
Additionally, after each move, if ZS the Coder is at level k, and the number on the screen is m, then m must be a multiple of k. Note that this condition is only checked after performing the press. For example, if ZS the Coder is at level 4 and current number is 100, he presses the '
' button and the number turns into 10. Note that at this moment, 10 is not divisible by 4, but this press is still valid, because after it, ZS the Coder is at level 5, and 10 is divisible by 5.
ZS the Coder needs your help in beating the game — he wants to reach level n + 1. In other words, he needs to press the '
' button n times. Help him determine the number of times he should press the ' + ' button before pressing the '
' button at each level.
Please note that ZS the Coder wants to find just any sequence of presses allowing him to reach level n + 1, but not necessarily a sequence minimizing the number of presses.
ZS the Coder 正在玩一个游戏。屏幕上显示着一个数字,还有两个按钮:“ + ”(加号)和“
”(平方根)。初始时,屏幕上显示的数字是 2。游戏中共有 n+1 个关卡,ZS the Coder 从第 1 关开始。
当 ZS the Coder 处于第 k 关时,他可以执行以下操作之一:
- 按下“ + ”按钮:该操作将屏幕上显示的数字恰好增加 k。即,若当前屏幕上的数字为 x,则变为 x+k。
- 按下“
”按钮:设此时屏幕上的数字为 x,按下后该数字变为
。随后,ZS the Coder 升级,当前关卡变为 k+1。此按钮仅当 x 是一个完全平方数(即存在正整数 m 使得 x=m2)时才可按下。
此外,每次按键操作后,若 ZS the Coder 当前处于第 k 关,且屏幕上显示的数字为 m,则必须满足:m 是 k 的倍数。注意,该条件仅在按键操作执行完毕后检查。例如,若 ZS the Coder 处于第 4 关、当前数字为 100,他按下“
”按钮,数字变为 10。此时,10 并不被 4 整除,但该操作仍然合法,因为操作完成后 ZS the Coder 进入第 5 关,而 10 能被 5 整除。
ZS the Coder 需要你的帮助来通关——他希望达到第 n+1 关。换言之,他需要恰好按下 n 次“
”按钮。请你帮他确定:在每一关按下“
”按钮之前,他应按下“ + ”按钮多少次。
请注意:ZS the Coder 只需找出任意一个可行的操作序列以到达第 n+1 关,并不要求该序列的总按键次数最少。
输入格式
The first and only line of the input contains a single integer n (1 ≤ n ≤ 100 000), denoting that ZS the Coder wants to reach level n + 1.
输入仅有一行,包含一个整数 n(1 ≤ n ≤ 100000),表示 ZS the Coder 希望达到第 n+1 级。
输出格式
Print n non-negative integers, one per line. i-th of them should be equal to the number of times that ZS the Coder needs to press the ' + ' button before pressing the '
' button at level i.
Each number in the output should not exceed 1018. However, the number on the screen can be greater than 1018.
It is guaranteed that at least one solution exists. If there are multiple solutions, print any of them.
输出 $ n $ 个非负整数,每行一个。其中第 $ i $ 个数应等于 ZS the Coder 在第 $ i $ 级时,在按下  按钮之前需要按 + 按钮的次数。
输出中的每个数均不应超过 $ 10^{18} $。但屏幕上显示的数字可以大于 $ 10^{18} $。
题目保证至少存在一个解。若存在多个解,输出任意一个即可。
输入输出样例
输入#1
3
输出#1
14 16 46
输入#2
2
输出#2
999999999999999998 44500000000
输入#3
4
输出#3
2 17 46 97
说明/提示
In the first sample case:
On the first level, ZS the Coder pressed the ' + ' button 14 times (and the number on screen is initially 2), so the number became 2 + 14·1 = 16. Then, ZS the Coder pressed the '
' button, and the number became
.
After that, on the second level, ZS pressed the ' + ' button 16 times, so the number becomes 4 + 16·2 = 36. Then, ZS pressed the '
' button, levelling up and changing the number into
.
After that, on the third level, ZS pressed the ' + ' button 46 times, so the number becomes 6 + 46·3 = 144. Then, ZS pressed the '
' button, levelling up and changing the number into
.
Note that 12 is indeed divisible by 4, so ZS the Coder can reach level 4.
Also, note that pressing the ' + ' button 10 times on the third level before levelling up does not work, because the number becomes 6 + 10·3 = 36, and when the '
' button is pressed, the number becomes
and ZS the Coder is at Level 4. However, 6 is not divisible by 4 now, so this is not a valid solution.
In the second sample case:
On the first level, ZS the Coder pressed the ' + ' button 999999999999999998 times (and the number on screen is initially 2), so the number became 2 + 999999999999999998·1 = 1018. Then, ZS the Coder pressed the '
' button, and the number became
.
After that, on the second level, ZS pressed the ' + ' button 44500000000 times, so the number becomes 109 + 44500000000·2 = 9·1010. Then, ZS pressed the '
' button, levelling up and changing the number into
.
Note that 300000 is a multiple of 3, so ZS the Coder can reach level 3.
在第一个样例中:
在第一关,ZS the Coder 按了 14 次 ‘ + ’ 按钮(屏幕初始数字为 2),因此数字变为 2+14⋅1=16。接着,ZS the Coder 按下了 ‘
’ 按钮,数字变为
。
随后,在第二关,ZS 按了 16 次 ‘ + ’ 按钮,因此数字变为 4+16⋅2=36。接着,ZS 按下了 ‘
’ 按钮,升级并使数字变为
。
随后,在第三关,ZS 按了 46 次 ‘ + ’ 按钮,因此数字变为 6+46⋅3=144。接着,ZS 按下了 ‘
’ 按钮,升级并使数字变为
。
注意:12 确实能被 4 整除,因此 ZS the Coder 可以到达第 4 关。
另外请注意:在第三关升级前仅按 10 次 ‘ + ’ 按钮是不可行的,因为此时数字变为 6+10⋅3=36,当按下 ‘
’ 按钮后,数字变为
,ZS the Coder 到达第 4 关。但此时 6 不能被 4 整除,因此这不是一个合法解。
在第二个样例中:
在第一关,ZS the Coder 按了 999999999999999998 次 ‘ + ’ 按钮(屏幕初始数字为 2),因此数字变为 2+999999999999999998⋅1=1018。接着,ZS the Coder 按下了 ‘
’ 按钮,数字变为
。
随后,在第二关,ZS 按了 44500000000 次 ‘ + ’ 按钮,因此数字变为 109+44500000000⋅2=9⋅1010。接着,ZS 按下了 ‘
’ 按钮,升级并使数字变为
。
注意:300000 是 3 的倍数,因此 ZS the Coder 可以到达第 3 关。
输入解题思路,AI测评打分。不知道怎么写?