Fácil20 pts
Halloween Sale
Traducción al español en progresoEl contenido detallado de esta lección aún se está traduciendo. Mientras tanto, se muestra en inglés.
Buy video games with decreasing prices: first game costs p, each next costs d less, but price never goes below m. With budget s, how many games can you buy? Example: p=20, d=3, m=6, s=80 → Prices: 20, 17, 14, 11, 8, 6, 6... → Can buy: 20+17+14+11+8+6=76 → 6 games (can't afford 7th at 6)
Entrada
Four space-separated integers: p d m s
Salida
A single integer: the number of games you can buy.
Ejemplo
20 3 6 80
Esperado
6
Loading editor…
Resultado
Sin salida aún. Ejecuta tu código para ver resultados.