CMIYC - Catch Me If You Can

no tags 

One day two friends rocko and hunter go to playground which in shape of regular connected polygon. They were confused about which game to play, suddenly rocko comes with an idea of playing Catch me if you can. In this game what they are supposed to do is to start from a check post in the ground and then simultaneously move in opposite direction with different speeds ( rocko with speed x and hunter with speed 2x). In each move they can hop to another check post. Note each check post is unit distance on periphery of polygon from another check post. 

Now what they want to find is at what distance from start point will they meet. Since both rocko and hunter are bit poor in mathematics, so they want your help to find that distance for them.

Note they can't meet in middle of two check posts.

Ex: suppose size of ground is 2 units. 

1 move: Rocko:1->2 and Hunter:1->2->1

2 move: Rocko:2->1 and Hunter:1->2->1

Thus, 1 is meeting point and its distance from start is 1-1=0


There is a single positive integer T (T <= 100000) on the first line of input which corresponds to the number of tests cases. Then T lines follow, each containing a number N which represents size of polygon field, where 0<N<=10^17


T lines containing distance of meeting point from start.




hide comments
saurav_555: 2020-03-02 23:23:56

easy peasy...

NISHANT RAJ: 2014-02-24 20:05:37

finally moved to tutorial..

Francky: 2014-02-24 18:39:17

It is tutorial stuff ; moved.

Jacob Plachta: 2014-02-24 00:44:34

This problem probably belongs in Tutorial.

abdelkarim: 2014-02-21 21:08:29

@RIVU DAS the same here :D

NISHANT RAJ: 2014-02-25 08:38:12

it should be moved to tutorial..

Bhavik: 2014-02-21 16:48:29

too easy...

aqfaridi: 2014-02-21 09:11:18

my 400th.. :)

NISHANT RAJ: 2014-02-25 08:38:18

Last edit: 2014-02-19 19:45:29
RIVU DAS: 2014-02-19 15:01:31

Reminded me of the movie!!! :p

Added by:aman jain
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem