CF 492A - Vanya and Cubes
Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 + 3 = 6 cubes, and so on. Thus, the i-th level of the pyramid must have 1 + 2 + ... + (i - 1) + i cubes.
Vanya wants to know what is the maximum height of the pyramid that he can make using the given cubes.
Input
The first line contains integer n (1 ≤ n ≤ 104) — the number of cubes given to Vanya.
Output
Print the maximum possible height of the pyramid in the single line.
Examples
input
1
output
1
input
25
output
4
Note
Illustration to the second sample:

------------------------------------------
Vanya 有 n 个立方体。 他决定用它们建造一座金字塔。 Vanya想要建造金字塔如下:金字塔的顶层必须由1个立方体组成,第二层必须由1 + 2 = 3个立方体组成,第三层必须由1 + 2 + 3 = 6个立方体组成,依此类推。 因此,金字塔的第 i 层必须有 1 + 2 + ... + (i - 1) + i 个立方体。
Vanya 想知道他使用给定的立方体可以制作的金字塔的最大高度是多少。
输入
第一行包含整数 n (1 ≤ n ≤ 104) — 给予 Vanya 的立方体数量。
输出
在一行中打印金字塔的最大可能高度。
-------------------------------------
下面是代码:
这里面++i跟i++没理清楚,结果错了一次,++i是当前循环就加上1,i++是下个循环再加1的。