Advertisement
a53

RATC

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