题目描述
The correct way of evaluating an expression with , +, and - is, first multiplication, then addition, and then subtraction. For example, the expression 2+37-5 = 2+21-5 = 23-5 = 18.
You are given integers N and X. Your task is to generate a string S of length N consisting only of , +, and - such that when these N operators are placed in order between (N+1) ones, the result of the expression becomes X.
For example, if S = ++--, the resulting expression is 1+1+1-1*1-1, which is then evaluated based on the rules above.
If multiple such strings exist, print any of them. If no such string exists, print -1 instead.
------ Input Format ------
- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of two space-separated integers N and X — the number of characters in the string and the result of expression after appending (N+1) ones between all operators.
------ Output Format ------
For each test case, output on a new line a string S of length N consisting only of *, +, and - that satisfies the given condition.
If multiple such strings exist, print any of them. If no such string exists, print -1 instead.
------ Constraints ------
$1 ≤ T ≤ 2000$
$1 ≤ N ≤ 10^{5}$
$-10^{5} ≤ X ≤ 10^{5}$
- The sum of $N$ over all test cases won't exceed $2\cdot 10^{5}$.
----- Sample Input 1 ------
3
3 4
2 -5
3 1
----- Sample Output 1 ------
+++
-1
*+-
----- explanation 1 ------
Test case $1$: A possible string satisfying the condition is +++. The corresponding expression is $1+1+1+1 = 4$ which is equal to $X$.
Test case $2$: It can be proven that no such string with length $N=2$ exists such that the corresponding expression evaluates to $-5$.
Test case $3$: A possible string satisfying the condition is +-. The corresponding expression is $1*1+1-1 = 1+1-1 = 2-1 = 1$ which is equal to $X$.
Note that there are other valid strings, such as +- and -*+. Any valid string will be accepted as output.
输入格式
见题面
输出格式
见题面