NeoYL's blog

By NeoYL, history, 8 months ago, In English

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
  • Vote: I like it
  • +12
  • Vote: I do not like it

»
8 months ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

interesting Blog i upvoted

»
8 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice Blogs