问题描述
Since so, arithmetic sequence is completely defined by the first member (A) and the increment value - step size - (B). First few members could be expressed as
A + (A + B) + (A + 2B) + (A + 3B) + …
You are to calculate the sum of first members of arithmetic sequence. Wikipedia page on arithmetic progression could be of significant help to one who meets them for the first time.
Input data: first line contains the number of test-cases.
Other lines contain test-cases in form of triplets of values A B N where A is the first value of the sequence, B is the step size and N is the number of first values which should be accounted.
Answer: you are to output results (sums of N first members) for each sequence, separated by spaces.
第一个数是初始数,第二个是步长,第三个是数字个数,求和。
Example:
代码
num=input()
for i in range(int(num)):
a=list(map(int,input().split()))
result=round((a[0]+a[0]+a[1]*(a[2]-1))*a[2]/2)
print(result,end=" ")