Triway Cup '18 Summer A - Arranged Marriage

View as PDF

Submit solution

Points: 7
Time limit: 0.1s
Java 8 0.3s
Memory limit: 256M

Author:
Problem type

The Taoist (Chinese Shaman) Bai Yuechu has been trapped by the Yichidao league for the entirety of his life. Now, they are forcing him to marry an underage girl! However, he has a plan to escape and win his freedom forever.

Bai Yuechu plans to get married to a stranger within the next N (N \le 2 \times 10^8) seconds, through the power of extreme - speed - dating. He is very attractive and has an initial attractiveness of A (A \le 100). He has arranged for a date with a new stranger at each second. However, instead of going on the i-th date, he can instead increase his attractiveness by B (B \le 100). It is a well known fact that Bai Yuechu's success on a date is based on his attractiveness during that second and that his total success among all the dates is equal to the sum of the individual successes on the dates he goes to. He would like you to help him calculate the maximum total success that he can achieve, if he increases his attractiveness at the right times.

Input Specification

Line 1: 3 integers, N, B, and A (1 \le N \le 2 \times 10^8, 0 \le A, B \le 100)

Sample Input

10 3 1

Sample Output

80

Explanation

Bai Yuechu increases his attractiveness by 3 in each of the first 5 seconds and goes on dates for the last 5 seconds.

This gives him a total success value of (1 + 3 \times 5) \times 5 = 80.


Comments

There are no comments at the moment.