Advertisement
Guest User

A

a guest
Aug 9th, 2013
1,938
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <cstdio>
  2. #include <utility>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int sgn(int x) {
  8. if (x > 0) return 1;
  9. if (x == 0) return 0;
  10. return -1;
  11. }
  12.  
  13. int main() {
  14. int x, y;
  15. scanf("%d %d", &x, &y);
  16. int v = abs(x) + abs(y);
  17. pair<int,int> f = make_pair(v * sgn(x), 0);
  18. pair<int,int> s = make_pair(0, v * sgn(y));
  19. if (f.first > s.first)
  20. swap(f, s);
  21. printf("%d %d %d %d\n", f.first, f.second, s.first, s.second);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement