Блог пользователя Mango-man

Автор Mango-man, история, 4 года назад, По-английски

how to solve this problem ?1265B - Beautiful Numbers

here is my submission in python 82612211

ok sorry for the joke if you don't find it funny.

but seriously i am not able to understand the idea of the editorial. please help me in this problem.

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

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This is how I solved this problem: I was iterating from 1 to n. Let l is the leftmost position of all number from 1 to i, and r — the rightmost one. Then i is a good number if and only if (r — l + 1) == i. Do you need a proof of that?