#include using namespace std; int howManyGames(int price_start, int discount, int match, int savings) { // Return the number of games you can buy int num_games = 0; int price_next = price_start; while (savings >= price_next) { // Purchase game savings -= price_next; num_games += 1; price_next -= discount; if (price_next < match) { price_next = match; } } return num_games; } int main() { int p; int d; int m; int s; cin >> p >> d >> m >> s; int answer = howManyGames(p, d, m, s); cout << answer << endl; return 0; }