zoj 2388.Beat the Spread!
2012-11-05 23:37
447 查看
Beat the Spread!
#include <fstream> #include <iostream> #include <cmath> using namespace std; int main(int argc, char* argv[]) { // ifstream cin("aaa.txt"); int n,x,y,a,b; cin>>n;//不理会第一个数字 while(cin>>a>>b) { //和比差小,不成立 if(a<b) { cout<<"impossible"<<endl; continue; } //分数只能是自然数(包括0) if((a+b)%2!=0 || abs(a-b)%2!=0) { cout<<"impossible"<<endl; continue; } x=abs((a+b)/2); y=abs((a-b)/2); if(x>y) cout<<x<<" "<<y<<endl; else cout<<y<<" "<<x<<endl; } return 0; }
相关文章推荐
- ZOJ 2388 Beat the Spread!
- zoj2388 Beat the Spread!
- zoj 2388 Beat the Spread!
- zoj 2388 Beat the Spread!
- zoj2388----------------Beat the Spread!
- zoj Beat the Spread!
- 2388_Beat the Spread!(知道两数和差,求两数)
- ACM HDU 1194 Beat the Spread!(简单的水题)
- POJ 2301 && HDU 1194 Beat the Spread!(水~)
- HDU 1194 Beat the Spread!
- 10812 - Beat the Spread!
- HDU 1194 Beat the Spread! 【水题+细心】
- POJ 2301 Beat the Spread!
- TOJ 1457. Beat the Spread!
- hdu 1194 Beat the Spread!
- UVa 10812 - Beat the Spread!
- [1194]:Beat the Spread!
- 【HDU】1194 Beat the Spread!
- ZOJ2388 Beat the Spread!
- HDU1194 POJ2301 UVA10812 ZOJ2388 Beat the Spread!【数学】