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

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)

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