Day, while researching the E5 measurement, Rick came up with the idea of ​​a device that would change humanity. Inhabitants of the E5 dimension once a millennium organize a big one-dimensional sea battle tournament. The device will perform the following task: help a participant in a one-dimensional sea battle tournament to place the maximum number of ships on the field. He has not yet decided how exactly he is going to change humanity with the help of his invention, but he is sure that he will be able, at least, to introduce the game in one-dimensional sea battle into our dimension and diversify people's lives. The field in a one-dimensional sea battle game has dimensions 1 × n . The task of the device is to find the maximum k such that one ship of size 1 × k , two ships of size 1 × ( k - 1) , ... , k ships of size 1 × 1 can be placed on the field , and the ships, as in a conventional sea fight, should not touch each other and intersect.

Input data
The only line of the input contains the number n - the number of cells in the field .

Output
Print a single number - the maximum k that you can arrange the ships, as described in the condition.

Example
input
7
output
2

Note
Explanation for the example: for a 1 × 7 field, the answer is 2. You can place one 1 × 2 ship and two 1 × 1 ( 2, 1, 1)

Yaneken Yaneken    3   24.12.2020 12:05    0

Ответы
Бозя1 Бозя1  23.01.2021 12:06

n = int(input())

a = 1

y = 1

while(a>=y):

   a+=1

   y+=(a*(a+1))/2

print(a-1)

Объяснение:

python code

ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика