Editorial for 2158: Цукерки або життя


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Автор, розробник, автор розбору: Iлля Пермяков

За два послiдовнi ходи (Алiса + Боб) — спочатку ходить Алiса, потiм Боб — з мiшка зникає 6 цукерок, з яких Боб отримує 3. Можна побачити, що якщо розбити усi ходи на такi пари, то в них врахуються усi ходи Боба. Таких пар буде ~⌊n/6 ⌋~, отже кiлькiсть цукерок, якi отримає Боб — ~⌊n/6 ⌋·3~.

n = int(input())
print((n // 6) * 3)

Коментарі

Please read the guidelines before commenting.


Ще немає коментарів.