SAC '22 Code Challenge 3 P1 - Hair Hazards

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

When school finishes, Fayez decides to experiment with new hair lengths.

Currently, Fayez has a hair length of H cm.

Whenever he visits his barber in the summer, his hair will be cut S cm shorter.

He will visit his barber Q times and wants to know his hair length after each haircut.

Can you help him?

Input Specification

The first line will contain H (100 \le H \le 100\,000), the length of Fayez's hair initially.

The next will contain S (1 \le S \le 1\,000), the length of hair trimmed off from each haircut.

The next line will contain Q (1 \le Q \le \lfloor \frac{H - 1}{S} \rfloor), the number of haircuts Fayez will get.

Output Specification

Output the length of Fayez's hair after each haircut in cm.

Sample Input

200
2
3

Sample Output

198
196
194

Comments

There are no comments at the moment.