Ad Code

Responsive Advertisement

Snowball


Author: Ismail Hosen


Daffodil International University








Problem Link




#include<bits/stdc++.h> 

using namespace std;

int main()

{

int w, h, u1, u2, d1, d2;

cin>>w>>h>>u1>>d1>>u2>>d2;

for(int i=h; i>=0; i--){

if(w<0)w=0;

if (i==d1)w-=u1;

else if(i==d2)w-=u2;

w+=i;

}

if(w<0)w=0;

cout<<w<<endl;

return 0;

Post a Comment

0 Comments