SP154 ROCK - Sweet and Sour Rock
Description
A manufacturer of sweets has started production of a new type of sweet called _rock_. Rock comes in sticks composed of one-centimetre-long segments, some of which are sweet, and the rest are sour. Before sale, the rock is broken up into smaller pieces by splitting it at the connections of some segments.
Today's children are very particular about what they eat, and they will only buy a piece of rock if it contains more sweet segments than sour ones. Try to determine the total length of rock which can be sold after breaking up the rock in the best possible way.
Input Format
The input begins with the integer t, the number of test cases. Then t test cases follow.
For each test case, the first line of input contains one integer N - the length of the stick in centimetres (1
Output Format
For each test case output a line with a single integer: the total length of rock that can be sold after breaking up the rock in the best possible way.