Advertisement
SSemen

Untitled

Oct 23rd, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.   int a, b;
  8.   cin >> a >> b;
  9.   int x = abs(b + a) / 2;
  10.   if (abs(b + a) % 2)
  11.     x++;
  12.   int y = abs(a - b) / 2;
  13.   if (abs(a - b) % 2)
  14.     y++;
  15.   if (abs(x - y) == b && x + y == a)
  16.     cout << x << " " << y;
  17.   else
  18.     cout << 0 << " " << 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement