NINJA4 - HELP SHELDON
Dr. Sheldon Cooper builds a MVPD replication of himself which he calls a "Mobile Virtual Presence Device" (MVPD) that would go through all the hazards of life that he would otherwise have to experience while he stays behind in a "secure, undisclosed location". Now the MVPD is initially standing at the origin of the Cartesian coordinate system, (0, 0). (More like Sheldon's spot (0, 0, 0, 0)). Then the MVPD makes N turns:
- On the first turn, the MVPD goes 1 unit to the right.
- On the second turn, the MVPD goes 2 units up.
- On the third turn, the MVPD goes 3 units to the left.
- On the fourth turn, the MVPD goes 4 units down.
- On the fifth turn, the MVPD goes 5 units to the right.
- And so on.
Given an integer N, find the position of Sheldon's MVPD so that he won't get lost somewhere.
Input Format
The first line contains a single integer, T, denoting the number of test cases.
For each test case, a single line contains a single integer - the value of N.
Output format:
For each test case output a single line, containing two integers - the coordinates of the MVPD after performing N turns.
Constraints:
1 <= T <= 100.
1 <= N <= 10^9.
Sample:
Input: 2 3 4 Output: -2 2 -2 -2
hide comments
harshitdd120:
2016-03-22 22:34:03
AC in 1 go
|
|
shubham9466:
2016-03-17 15:42:19
Too easy!! AC in one go :)
|
|
code_nit:
2016-03-12 06:02:23
nice problem AC !! |
|
gurugs:
2016-02-28 18:11:36
getting running judge(9) ...and finally WA...what does that mean? I got correct answers for my test case... |
|
silhouette:
2016-02-28 14:58:33
AC in 1 go..easy one...! |
|
Harish Mohan:
2016-02-25 16:21:37
Easy just find the pattern ! A big delight for Sheldon Fans ! AC in one go :) |
|
it_is_me:
2016-02-24 08:29:54
Getting wrong ans please someone me a copy of their selected solution's output help please |
|
hanstan:
2016-02-23 16:00:07
Easy one. My 85th :3 |
|
queen_123:
2016-02-22 12:48:39
don't think much.............its following a pattern so that without use of any loop it can get green light |
|
priyanshukm_17:
2016-02-21 10:09:43
Easy one!!
|
Added by: | mombassa |
Date: | 2016-02-17 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |