最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 492A - Vanya and Cubes

2023-07-22 10:54 作者:您是打尖兒還是住店呢  | 我要投稿

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 想知道他使用給定的立方體可以制作的金字塔的最大高度是多少。


輸入

第一行包含整數(shù) n (1?≤?n?≤?104) — 給予 Vanya 的立方體數(shù)量。


輸出

在一行中打印金字塔的最大可能高度。

-------------------------------------

下面是代碼:

這里面++i跟i++沒理清楚,結(jié)果錯了一次,++i是當前循環(huán)就加上1,i++是下個循環(huán)再加1的。

CF 492A - Vanya and Cubes的評論 (共 條)

分享到微博請遵守國家法律
随州市| 福安市| 本溪市| 新龙县| 茶陵县| 和平县| 龙门县| 隆德县| 丘北县| 乌兰浩特市| 宁安市| 清水县| 乌海市| 贵溪市| 通江县| 遵义市| 库尔勒市| 海伦市| 饶河县| 汾阳市| 清苑县| 大埔区| 崇左市| 夏津县| 朝阳县| 嘉定区| 桐梓县| 工布江达县| 陆丰市| 石家庄市| 来凤县| 固安县| 阿合奇县| 达尔| 武隆县| 新建县| 佳木斯市| 江都市| 石台县| 大足县| 庐江县|