302545: CF492A. Vanya and Cubes
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Vanya and Cubes
题意翻译
Vanya得到了 $n$ 个立方体。 他决定建造一座金字塔。 Vanya想要建造金字塔如下: 金字塔的顶层必须由 $1$ 个立方体组成, 第二层必须由 $1+2=3$ 个立方体组成, 第三层必须有 $1+2+3=6$ 个立方体..... 依此类推。 因此,金字塔的第i级必须具有 $1+2+...+(i-1)+ i$ 个立方体。 Vanya想要知道他可以使用给定的立方体制作金字塔的最大高度。 感谢@HNFMS__viston 提供的翻译题目描述
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.输入输出格式
输入格式
The first line contains integer $ n $ ( $ 1<=n<=10^{4} $ ) — the number of cubes given to Vanya.
输出格式
Print the maximum possible height of the pyramid in the single line.
输入输出样例
输入样例 #1
1
输出样例 #1
1
输入样例 #2
25
输出样例 #2
4