409599: GYM103643 B Operations

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Operationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Bossologist is brushing up on his arithmetic skills, and has found an interesting way to practice by doing $$$P$$$ ($$$1 \leq P \leq 10^5$$$) problems of a certain format. For the $$$p$$$th problem, he first picks two numbers $$$A_p$$$ and $$$B_p$$$. He will then use the four operations $$$+, -, *, \div$$$ to combine $$$A_p$$$ and $$$B_p$$$ in any way (i.e. Bossologist finds $$$A_p+B_p$$$, $$$A_p-B_p$$$, $$$B_p+A_p$$$, etc.). For each of $$$P$$$ problems determine the number of distinct answers Bossologist gets.

Input

The first line of input will be $$$P$$$.

The next $$$P$$$ lines will each contain the two numbers $$$A_p$$$ and $$$B_p$$$ ($$$1 \leq A_p, B_p \leq 10^4$$$) he picks for the $$$p$$$th problem.

Note that test case $$$0$$$ is the sample case, which is not worth any points.

Output

Output $$$P$$$ lines where the $$$p$$$th line gives the number of distinct answers Bossologist gets for problem $$$p$$$.

ExampleInput
4
2 19
3 5
4 3
6 6
Output
6
6
6
4
Note

For the first problem, the possible answers are $$$2 + 19 = 21$$$, $$$2 - 19 = -17$$$, $$$19 - 2 = 17$$$, $$$19 \cdot 2 = 38$$$, $$$19 \div 2 = 9.5$$$, and $$$2 \div 19 \approx 0.105$$$, for a total of $$$6$$$ distinct answers.

$$$---------------------------------------------$$$

Problem Idea: Bossologist

Problem Preparation: Bossolgist

Occurrences: Novice 2

加入题单

上一题 下一题 算法标签: