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

Автор NeoYL, история, 3 месяца назад, По-английски

This is the 8th episode of this "note" series. I will write notes on problems (normally around 2500-ish problems), that are both interesting and educational. I normally will spend a few hours on each problem, so can I please have an upvote plssss.

Difficulty rating
Tags

Problem link

Problem paraphrased:

You are given an integer $$$N$$$.

You would need to start from node $$$0$$$, visit every other node once and end at node $$$0$$$ again.

When we reach node $$$i$$$, we can only go to $$$(2*i)$$$ $$$mod$$$ $$$N$$$ or $$$(2*i + 1)$$$ $$$mod$$$ $$$N$$$.

Print a cycle that contains all $$$N$$$ nodes and starts and ends at node $$$0$$$.

Hint 1
Hint 2
Solution

AC code link

Here is the proof for Hint 1.

proof of Hint 1
  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

»
3 месяца назад, # |
Rev. 2   Проголосовать: нравится -8 Проголосовать: не нравится

interesting Blog i upvoted

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

Nice Blogs