#CCBCHBA0000058. Bậc thang tiền tiết kiệm (Regular Savings)
Bậc thang tiền tiết kiệm (Regular Savings)
Regular Savings
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
You start with x units of money. At the end of each of n periods, you add exactly c units. There is no interest or withdrawal. Print the final balance; when n=0, it remains x.
Input
One line: integers x, c, n in this order; 0<=x<=10^6, 0<=c<=10^4, 0<=n<=1000.
Output
One integer: the balance after exactly n periods.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input:
100 25 3
Output:
175
Explanation:
Three deposits give 100, 125, 150, then 175.
Example 2
Input:
123 50 0
Output:
123
Explanation:
Zero periods means no addition.