int main()
{
unsigned long s,d,t;
//freopen("in.txt","r",stdin);
scanf("%lu",&t);
while(t--)
{
scanf("%lu%lu",&s,&d);
if((s<d)||(s+d)&1) //&1 use to check even or odd;s<d used for non negative & (s+d)&1 used for integer
printf("impossible\n");
else
printf("%lu %lu\n",(s+d)>>1,(s-d)>>1); //(s+d)>>1=(s+d)/2,(s-d)>>1=(s-d)/2
}
return 0;
}
No comments:
Post a Comment