Allowance (2)

You have saved n euros. Additionally, every Monday of the next t weeks,
you will be given a weekly allowance of a₁, a₂, ..., a_(t) euros,
respectively. Every week, you have a fixed amount of expenses that sums
up to d euros.

Write a program that counts how many weeks you end up with a strictly
positive balance.

Input

The input consists of three naturals d ≥ 0, n ≥ 0 and t > 0, which
represent fixed weekly expenses, the initial savings, and the number of
weeks with allowance, respectively.

Following, there are the quantities corresponding to the t weekly
allowances a₁, ..., a_(t). Every week allowance is a natural number
a_(i) ≥ 0.

Output

The output is a natural number indicating the number of weeks which end
up with a strictly positive balance, after paying the weekly expenses.

Your program must meet the output format described in the examples an it
should follow a right programming style. You may also decide to include
comments, if appropriate.

Problem information

Author: Unknown
Translator: Maria Serna

Generation: 2026-01-25T22:47:11.862Z

© Jutge.org, 2006–2026.
https://jutge.org
