fork download
  1. #include <iostream>
  2. #include <cctype>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long a,b,x = 0,y = 0,c = 0;
  7. cin >> a >> b;
  8. if ( a < b){c = a;a = b;b = c;}
  9. if ((a - b) % 2 == 0){
  10. x = (a - b) / 2;
  11. y = a - x;}
  12. if (y < 0){y *= -1;}
  13. if (x == 0 || y == 0){x =0;y = 0;}
  14. cout << x << " "<< y;
  15. return 0;
  16. }
Success #stdin #stdout 0s 4464KB
stdin
100 100
stdout
0 0