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

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)

Ответ:
maksimkakravchenko
maksimkakravchenko
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
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?