A - JB Loves Math

SDUT 2022 Spring Team Contest(for 21) - 12 - Virtual Judge 

JB is good at Math, so he thinks all the math problems in the world are easy.

But one day, he meets a math problem which he can't solve, so he asks you to help him.

JB will give you two numbers aa and bb, and you should then choose a positive odd number xx and a positive even number yy. You can let aa add xx or let aa minus yy in one operation. You should change aa into bb in the minimal number of operations. Note that you are not allowed to change the value of xx and yy.

Input

In the first line, there is one integer TT (1\leq T\leq 10^51≤T≤105), denoting the number of test cases.

For each test case, there is one line containing two numbers aa and bb (1\leq a,b\leq 10^61≤a,b≤106), denotes the number given by JB.

Output

For each test case, print one number, denoting the minimal number of operations you need to change aa into bb.

Sample 1

Inputcopy Outputcopy
2
3 6
5 3
1
1

题意:给定两个正整数 a, b,你需要选定一个正奇数 x 和一个正偶 数 y。 之后的每一步操作中,你可以将 a 增大 x 或者将 a 减小 y。 求把 a 变成 b 的最少操作次数。

#include
using namespace std;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b;
        scanf("%d %d",&a,&b);
        if(a==b)printf("0\n");
        else if(a

你可能感兴趣的:(p2p,linq,网络协议)