UVA 10812

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=1753&mosmsg=Submission+received+with+ID+11404818

给出俩个胜利者的分数的和与差,求出这两个分数,用二元一次方程组可以求出答案。注意:根据实际:分数是整数,且不为负

View Code
#include<stdio.h>
int main()
{
 long long s,d,n;
 scanf("%lld",&n);
 while(n--)
     {
      scanf("%lld%lld",&s,&d);
      if((s+d)%2==0&&(s-d)%2==0&&((s+d)>=0)&&((s-d)>=0))
         printf("%lld %lld\n",(s+d)/2,(s-d)/2);
      else printf("impossible\n");
     }
 return 0;
}
原文地址:https://www.cnblogs.com/huzhenbo113/p/2950663.html