hdu-1194 Beat the Spread!

#include<stdio.h>
int main()
{
   int s,n,d,x,y;
   scanf("%d",&n);
   while(n--)
   {
   int flag=0;
      scanf("%d%d",&s,&d);
   if(s<d)
    flag=1;
   if((s+d)%2!=0)
    flag=1;
   x=(s+d)/2;
   y=s-x;
   if(flag==1)
    printf("impossible\n");
   else
    printf("%d %d\n",x>y?x:y,x>y?y:x);
   }
   return 0;
}       注意特殊数据100   1,这道题还是比较简单的

你可能感兴趣的:(hdu-1194 Beat the Spread!)