1

NINJA KI GANIT

Difficulty: MEDIUM
Avg. time to solve
20 min
Success Rate
80%

Problem Statement
Suggest Edit

Ninja always uses his calculator for doing addition, subtraction, multiplication, and division but due to some technical fault in his calculator only the “+” operator is working and all other operators are not in working condition.

Now his teacher gives him the question of subtraction, multiplication, and division, and now ninja is thinking of the solution of these questions by using the “+” operator as only the “+” operator is in working condition.

So help our ninja to do the subtraction, division, and multiplication with the help of addition.

So your task is to write a code that can do subtraction, multiplication, and division, and you are allowed to use only the “+” operator or we can say addition.

Input Format :

The first line of input contains the ‘T’ number of test cases.

The first line of each test case contains two integers ‘N’ and ‘M’.

Output Format :

For each test case print all three results subtraction result, multiplication result, division result respectively in form of a vector.
Note:
You do not need to print anything; it has already been taken care of. Just implement the function.

Constraints :

1 <= T <= 100
-1000 <= N <= 1000
-1000 <= M <= 1000  and M != 0 

Time Limit: 1 sec

Sample Input 1 :

2
8 2
16 4

Sample Output 1 :

6 16 4
12 64 4

Explanation Of Sample Input 1 :

Test Case 1:

In the first line, there is the number of test cases i.e., 2, and in the next line‘8’and ‘2’is the integer on which operations are to be performed.
So after operations like after subtraction by using addition we get “16-4=12”, after multiplication by using addition we get “16*4=64”, after division by using addition we get “16/4=4”.


Test Case 2:

For this test case integers are “16” and “4”.
So after operations like after subtraction by using addition we get “8-2=6”, after multiplication by using addition we get “8*2=16”, after division by using addition we get 8/2=4.

Sample Input 2 :

2
4 -2
9 -3

Sample Output 2 :

6 -8 -2
12 -27 -3
Reset Code
Full screen
copy-code
Console