Thursday, January 4, 2018

UVa problem solution 10812 - Beat the Spread!

problem link:


Discuss: just do the class eight problem.no tricky part in this problem.

try yourself,before see the code



#include<stdio.h>
int main()
{
    int a,b,num,m,i,j,t;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d %d",&a,&b);
        if(a<b||(a-b)%2!=0)
            printf("impossible\n");
        else
        {
            m=(a-b)/2;
            num=m+b;
            printf("%d %d\n",num,m);
        }
    }
    return 0;
}

No comments:

Post a Comment