HDU 1194 Beat the Spread!

http://acm.hdu.edu.cn/showproblem.php?pid=1194

跟着狗畅找了道水题做,他真无聊啊。。。

View Code
#include <iostream>
using namespace std ;
int main()
{
    int n,i;
    int s,d;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d%d",&s,&d);
        for(i=s;i>0;i--)
            if(abs(i*2-s)==d)
            {
                printf("%d %d\n",i,s-i);
                break;
            }
        if(i==0)
            puts("impossible");
    }
    return 0;
}
原文地址:https://www.cnblogs.com/xiaohongmao/p/2532100.html