#P5534. 【XR-3】等差数列
【XR-3】等差数列
Description
Xiao X gives you the first two terms and the number of terms of an arithmetic progression. Please find the sum of all terms of this arithmetic progression.
Arithmetic progression: For an -term sequence , if for any it satisfies , where is a constant, then this sequence is called an arithmetic progression.
Input Format
One line with integers , representing the 1st and 2nd terms of the arithmetic progression and the number of terms.
Constraints:
- .
- .
Output Format
One line with one integer, representing the answer.
1 2 3
6
-5 -10 5
-75
Hint
Sample Explanation
This arithmetic progression is 1 2 3, and the sum of its terms is .
Translated by ChatGPT 5
京公网安备 11011102002149号