Блог пользователя stould

Автор stould, 11 лет назад, По-английски

I was trying to solve the following problem:Death Row

I spent the whole morning trying to solve it, but just wrong answer.. I just realized that the minimum time that he and his family still living is when Yama at every visit, kills M people and (N-M) >= 2, and when is remaining just N = 2 people, Yama need to visit more two times. I guess it is right, but I'm receiving wrong answer..

Can someone help me ? Thanks in advance.

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

If I understood the problem correctly then this is the solution:

If n ≤ 3 then answer is n

else if n is even then answer is 3

else answer is 4.

Reasoning is trivial.