#include using namespace std; int howManyGames(int p, int d, int m, int s) { // Return the number of games you can buy int cost=p; int games=0; while(s>0) {s-=cost; if(cost-d>=m) cost-=d; else cost=m; if(s>=0) games++; } return games; } int main() { int p; //base price int d; //difference int m; //minimum int s; //rokda cin >> p >> d >> m >> s; int answer = howManyGames(p, d, m, s); cout << answer << endl; return 0; }