I - MaratonIME divides fairly

Statements

In a country trip, the contestants decided to play a soccer match. Yan, who was a professional player once, decided not to play to keep the teams balanced. He wanted to participate in another way, so he decided to choose the two teams.

Unfortunately, unlike soccer, Yan is very bad at math and doesn't know if he divided the teams fairly. Yan considers a division fair if the absolute difference between the number of players in each team is minimum. Can you help him?

Input

The first line has a single integer T, the number of test cases. The next T lines have two integers a and b, the number of players in each team.

  • 1 ≤ T ≤ 1000.
  • 0 ≤ a, b ≤ 109.

Output

Print T lines, one for each test case.

If Yan was fair, output the word "Ok".

If Yan wasn't fair, output two integers x and yx ≤ y, the sizes of the teams in a fair division.

Example

Input

2
2 2
0 2

Output

Ok
1 1

题目大意及思路:给你2个数,来判断。如果他们相等或者差距为1的话,直接输出OK,反之,相加除以2.

输出的话。前面的数小于后面的数。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int t, sum, a, b;
    scanf("%d", &t);
    while(t--)
    {
        scanf("%d%d", &a, &b);
        sum = a + b;
        if(a == b || a + 1 == b || b + 1 == a)
        {
            printf("Ok\n");
        }
        else if(sum % 2 == 0)
        {
                printf("%d %d\n", sum / 2, sum / 2);
        }
        else
        {
            printf("%d %d\n", sum / 2, sum / 2 + 1);
        }
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_40915439/article/details/81812298
I