Thursday, June 14, 2018

AP2 - AP - Complete The Series (Easy) : Classical

#The solution in Python 3 is as follows:

t= int(input())
i=0
while i<t:
a, b, c = map(int,input().split())
n = (c*2)//(a+b)                             #No.of terms
d = (b-a)//(n-5)                              #difference
m = a-2*d                                     #first element
print (n)
print(" ".join(str(m+d*i) for i in range(n)))
i+=1


#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!