Subscribe Us

Responsive Advertisement

Advertisement

URI Online Judge | 2568 Actions solution in cpp

 

uri 2568 solution in cpp

by ujjal roy



#include<bits/stdc++.h>

using namespace std;

main()

{


    int d,i,x,f,r,j;

    cin>>d>>i>>x>>f;

    r=i;

    for(j=d+1;j<=d+f;j++)

    {

        if(j%2==0) r+=x;

        else r-=x;


    }


    cout<<r<<endl;

    return 0;


}


Post a Comment

0 Comments