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; } }
相关文章推荐
- windows.open()、close()方法详解
- QtInternal 之 高效使用QString
- Cisco路由器无日志信息
- 建造者模式
- 开源 java CMS - FreeCMS2.5 标签 infoSearch
- fast-RCNN跑通Demo
- fast-RCNN跑通Demo
- 【requireJS使用心得】
- 理解OAuth 2.0
- vim中使用正则表达式
- 相对定位绝对定位
- android Studio快捷方式
- poj3304
- HDU 5752
- Sqlite
- RxJava的使用
- 替换Gravatar头像默认服务器
- IDispatch接口 - GetIDsOfNames和Invoke(转)
- codevs 1913 数字梯形问题 费用流
- 音频播放AVFoundation框架