LCC '21 Contest 3 J3 - Tracy's WPM

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Tracy has an essay due in N hours. Unfortunately, she can only type at a speed of 18 words per minute. However, she has M cups of tea! The first cup of tea she drinks will increase her typing speed by 1 words per minute, and each subsequent cup will increase it by 1 more than the previous cup. This means that the second cup of tea will increase her words per minute by 2, to a total of 21.

The effects of a cup of tea will last for 1 hour, and it takes Tracy no time to drink a cup. However, she can only handle the effects of up to K cups of tea at the same time. Given this, can you output how many words of her essay Tracy will be able to type within the N hours?

Input Specification

The first line will contain one integer N (1 \leq N \leq 10^2), the number of hours until Tracy's essay is due.

The next line will contain two space-separated integers, M (1 \leq M \leq 50), and K (1 \leq K \leq M), the number of cups of tea she has, and how many cups of tea Tracy can drink in succession.

Output Specification

Output the number of words Tracy can type by the time the essay is due.

Sample Input 1

5
3 2

Sample Output 1

5640

Explanation for Sample 1

Tracy can start by drinking 2 cups of tea, making her typing speed 21 words per minute. Then, she types for 1 hour, writing 1260 words, and the tea wears off. She then drinks 1 cup of tea, making her typing speed 19 words per minute. She types for 1 hour, writing 1140 words, and the tea wears off. Finally, she types at 18 words per minute for 3 hours, writing 3240 words. Thus she writes a total of 1260 + 1140 + 3240 = 5640 words.

Sample Input 2

100
25 7

Sample Output 2

113640

Comments

There are no comments at the moment.