Simple Game
Time Limit: 0.5 sec
The Problem
T**** has become bored with her studies. So she wants to play a game. She has a positive integer N. Initially, She chooses an integer x such that 0 ≤ x ≤ N. Then, she plays N rounds numbered from 1 to N. In round number i, she has to add or subtract i from the current value of her number x. If the new value of x remains non-negative and ≤ N, then she wins this round. Otherwise, she loses and the game ends.
T**** wants to win the maximum number of rounds. She wants Porag to help her. But as We all know that Porag is way too lazy. Now you have to help T**** by writing a program.
The Input
The first line of the input will contain an integer T (1 ≤ T ≤ 500), denoting the number of test cases. Each of the next T lines will contain an integer N (1 ≤ N ≤ 100000).
The Output
For each test case, print two lines. On the first line, print the maximum number of rounds that T**** can win and the number x. On the second line, print a string of characters '+' or '-', which describe T****'s strategy (adding or subtracting i in the respective rounds).
If there are multiple solutions, print any of them.
Sample Input
2
1
2
Sample Output
1 0
+
2 1
-+
Explanation
In both test cases, T**** is able to win all N rounds.
In the first test case, T**** can choose x = 0 and win the only round by adding 1.
In the second test case, T**** chooses x = 1. In the first round, she subtracts 1 from it and has x = 0. In the second round, she adds 2 to it and has x = 2.
Online Practice Contest 4 [School & College Level]
Problem Setter: Parag Paul