Lucian_Adrian

#3183 RATC

Oct 12th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n, x , y , p;
  6. cin >> n >> x >> y >> p;
  7. if(p == 1)
  8. {
  9. int u=0, c=0;
  10. for(int i = 1 ; i <= n; ++i)
  11. cin >> x >> y, u += x, c += y;
  12. cout << u << ' ' << c << ' ' << u-c;
  13. }
  14. else
  15. {
  16. int a, b, u = 0;
  17. for(int i = 1; i < x; ++i)
  18. cin >> a >> b, u+=a, u-=b;
  19. for(int i = x; i <= n; ++i)
  20. cin >> a >> b;
  21. if(u < y)
  22. cout << "NU";
  23. else
  24. cout << "DA";
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment