1194:Beat the Spread!
2015-08-28 14:12
253 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1194
方法:无,解方程算是吗?
思路:大水题,但是有一个细节需要关注,那就是比赛的得分要求是非负的整数,所以在解完方程后要关注到数据的筛选问题。
难点:关注细节处理
方法:无,解方程算是吗?
思路:大水题,但是有一个细节需要关注,那就是比赛的得分要求是非负的整数,所以在解完方程后要关注到数据的筛选问题。
难点:关注细节处理
#include <iostream> using namespace std; int main() { int t,sum,sub,n1,n2; while(cin>>t) { while(t--) { cin>>sum>>sub; n1 = (sum+sub)/2; n2 = sum - n1; if(n1 < 0||n2 < 0||(sum+sub)%2 != 0) cout<<"impossible"<<endl; else cout<<n1<<" "<<n2<<endl; } } }
相关文章推荐
- 微信支付的问题记录
- Qt4中的模态与非模态对话框用法总结
- [转]NSIS:安装、卸载时检查程序是否正在运行
- vector在C++中的基本用法
- laravel的解决方案
- mysql 必须掌握的工具pt-query-digest安装
- OAF学习笔记-14-CO中获取VO中的值
- logstash,elasticsearch,kibana三件套安装
- Oracle游标示例
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值
- 数字转换成中文人民币大写
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值
- OAF学习笔记-14-CO中获取VO中的值