发布时间: 2017年12月10日 22:14 最后更新: 2017年12月10日 22:19 时间限制: 1000ms 内存限制: 512M
FSX often comes up with some strange ideas. Now he gives you a non-negative integer s and defines a positive integer n is a good number of s when it meets the following condition: For every integer from 1 to n, you can choose to add it or minus it. If there’s a way to make the final result equal to s, then FSX regards n as a good number of s. Now FSX wants you to find the minimum good number n for each given s.
Input starts with an integer T(T<=10^5), denoting the number of test cases.
For each test case, there is only one line describing the given integer s(0<=s<=10^9).
For each test case output the answer n in one line.
3 0 1 10
3 1 4
For the first test case, we can find that +1+2-3=0.
For the second test case, we can find that +1=1.
For the third test case, we can find that +1+2+3+4=10.