Advertisement
Guest User

Untitled

a guest
Jan 17th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. long long a, b, c, d;
  8. cin >> a >> b >> c >> d;
  9. long long x1 = min(a, b), z3 = min(c, d);
  10. long long x3 = min(b - x1, d - z3), z1 = min(a - x1, c - z3);
  11. long long y1 = a - x1 - z1, x2 = b - x1 - x3, z2 = c - z1 - z3, y3 = d - x3 - z3;
  12. long long y2 = 0;
  13. cout << x1 + x2 + x3 + y1 + y2 + y3 + z1 + z2 + z3 << '\n';
  14. cout << x1 << " " << y1 << " " << z1 << '\n';
  15. cout << x2 << " " << y2 << " " << z2 << '\n';
  16. cout << x3 << " " << y3 << " " << z3 << '\n';
  17. cout << '\n';
  18.  
  19. cout << a + b + c + d << '\n';
  20. cout << 0 << " " << a << " " << 0 << '\n';
  21. cout << b << " " << 0 << " " << c << '\n';
  22. cout << 0 << " " << d << " " << 0 << '\n';
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement