Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

bohot_hard_123's blog

By bohot_hard_123, history, 4 weeks ago, In English,

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.

 
 
 
 
  • Vote: I like it
  • -3
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by bohot_hard_123 (previous revision, new revision, compare).

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

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?

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    sorry i doesn't understand can you elaborate more deeply.

    looks like you are using same formula which is describe in editorial.

    and also thanks for the replying on my blog