您的位置:首页 > 其它

HDU 1194 - Beat the Spread!

2016-07-28 11:08 405 查看
给两数之和和两数之差,求两数,两数还必须同奇偶

#include <iostream>
using namespace std;
int main()
{
int a,b,t;
cin>>t;
while(t--)
{
cin>>a>>b;
int x = ( a + b ) / 2;
int y = ( a - b ) / 2;
if((a-b)%2||(a+b)%2||x<0||y<0) puts("impossible");
else cout<<x<<" "<<y<<endl;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: