Advertisement
erfanul007

CF A

Jan 5th, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. int w,h,u1,u2,h1,h2,a[110],i,j;
  7. for(i=0;i<=100;i++){
  8. a[i]=0;
  9. }
  10. cin>>w>>h;
  11. cin>>u1>>h1;
  12. a[h1]=u1;
  13. cin>>u2>>h2;
  14. a[h2]=u2;
  15. for(i=h;i>=0;i--){
  16. w+=i;
  17. w-=a[i];
  18. if(w<0)
  19. w=0;
  20. }
  21. cout<<w<<endl;
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement