Suhana and Matrix World
All submissions for this problem are available.
Suhana is a travel girl. Being a coder, she can assume the world as a matrix.
Suhana starts traveling from (0, 0).
She takes one step in the x-direction and two steps in the y-direction alternatively.
In short, she starts from (0, 0). She repeats following operations in sequence :
- Take one step in x-direction.
- Take two steps in y-direction.
Where will she be after M steps ?
First line contains T, number of test cases. Each test case contains M on a new line.
For each test case output the coordinates for Suhana's final location.
Input: 5 0 1 2 3 4 Output: 0 0 1 0 1 1 1 2 2 2
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.