Sunday, October 18, 2009

Puzzle 56 – Cube Traversal

Language – Java | Type – Concept | Last date 25-Oct-2009 12:00 p.m. IST | Points 5

We been dealing with Java concepts lately and its time to give concepts a break and get to some real world puzzles. Here is a small programming puzzle to get things started. Do let me know what you think of this question so I could think about adding more questions like these.

Submitting java code on scarky has few rules that need to be followed.
1. You can just have one class and it must be named Main. It should not be inside any package.
2. You need to read all input before you can start writing any output. (Use System.out.print() & System.out.println() for output)
3. For the exact format of input and output refer to the example test case.

You can find a standard template to read the input data here.

Your solution would be evaluated automatically by scarky.
In case of any issues you could reach me at


  1. I believe this isn't the format of your blog. If I want puzzles like this I go to TopCoder.

  2. in the output, shouldn't it be
    instead of



Solution for this question?