hdu1194-Beat the Spread!
http://acm.hdu.edu.cn/showproblem.php?pid=1194
理解题意
#include<iostream> #include<cstring> #include<cstdio> using namespace std ; int main() { int Case ; int m , n; int a , b ; cin >> Case ; while( Case-- ) { cin >> m >> n ; if( m < n ) cout << "impossible" << endl ; else if( ( m + n ) % 2 != 0) cout << "impossible" << endl ; else { a = ( m + n ) / 2 ; b = ( m - n ) / 2 ; if( a < b ) int t = a , a = b , b = t ; cout << a << " " << b << endl ; } } return 0 ; }