В
Все
Х
Химия
В
Видео-ответы
А
Алгебра
Г
Геометрия
О
ОБЖ
Д
Другие предметы
У
Українська література
Р
Русский язык
Б
Беларуская мова
У
Українська мова
Э
Экономика
Ф
Физика
М
Математика
Ф
Французский язык
Г
География
И
Информатика
М
МХК
О
Окружающий мир
П
Психология
Н
Немецкий язык
О
Обществознание
П
Право
И
История
М
Музыка
Л
Литература
Қ
Қазақ тiлi
Б
Биология
А
Английский язык
даша3634
даша3634
31.01.2021 02:40 •  Информатика

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)

Ответ:
kresofbro
kresofbro
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

0,0(0 оценок)
Популярные вопросы: Информатика
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?