Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • This solution does not take into account the order of the C(XxN) values, and produces output that is different from the desired result as specified in the question. It does not matter though, because the order is not important for the author of the question. Commented Nov 4, 2021 at 17:49
  • The author already stated in a comment that the output order doesn't matter. You can't expect them to provide every possible variation of output order in the question and it's pointless commenting on or editing every answer to say it has the desired behavior. if you feel it's not clear from the question that the order of output lines doesn't matter then edit the question (or ask the question author to clarify). Commented Nov 4, 2021 at 17:51
  • Strictly speaking your answer provides a solution without any explanation of how it works. Commented Nov 4, 2021 at 17:52
  • 1
    You win. I'm moving on. Commented Nov 4, 2021 at 17:56
  • 1
    @ЯрославРахматуллин the solution given by Ed Morton is quite good. Commented Nov 4, 2021 at 23:11