Codeforces Round #280 (Div. 2) A_html/css_WEB-ITnose
题目:
A. Vanya and Cubes
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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.
Sample test(s)
input
output
input
25
output
Note
Illustration to the second sample:
没啥好说的。模拟一下就可以了,还wa一发不应该..
#include#include #include #include #include #include #include #include #include #include #include #include #include
上一篇: 微信小程序-获得用户输入内容
推荐阅读
-
Codeforces Round #435 (Div. 2)-B. Mahmoud and Ehab and the bipartiteness
-
Codeforces Round #279 (Div. 2) 解题报告_html/css_WEB-ITnose
-
Codeforces Round #340 (Div. 2)-E-XOR and Favorite Number(莫队)
-
Codeforces Round #482 (Div. 2) D. Kuro and GCD and XOR and SUM(数学+01字典树)(好题)
-
Codeforces Round #553 (Div. 2) B. Dima and a Bad XOR(异或+思维)
-
Codeforces Round #246 (Div. 2) ?B. Football Kit_html/css_WEB-ITnose
-
Codeforces Round #261 (Div. 2)B. Pashmak and Flowers(容易)
-
Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama(树状数组+偏序)
-
Educational Codeforces Round 37 (Rated for Div. 2) E. Connected Components?(图论+连通块+bfs)
-
Educational Codeforces Round 66 (Rated for Div. 2)-E. Minimal Segment Cover