spoj#GP1. GP - Complete the Series v1 ()
GP - Complete the Series v1 ()
Geometric progression(GP) is a set in which the ratio of 2 consecutive numbers is same. for eg, 1,2,4,8,16.... In this the ratio of the numbers is 2.
The task here is very simple indeed.
You will be given the 3rd term , 3rd last term and the sum of the series. You need print length of the series & the series.
Input
First line will contain a number indicating the number of test cases.
Each of the following t lines will have 3 number '3term' ,'3Lastterm' and 'sum'
3term - is the 3rd term in of the series and
3Lastterm - is the 3rd term in of the series and
sum - is the sum of the series.
Output
For each input of the test case, you need to print 2 lines.
fist line should have 1 value- number of terms in the series.
2nd line of the output should print the series numbers separated by single space
Example
Input:
1
4 64 511
Output:
9
1 2 4 8 16 32 64 128 256
NOTE -
All the values will be in the range [0, 2^64] inclusive
The series will have at least 6 elements.
number of test cases <=100.
The Ratio in all the cases will be an integer. (Thanks Mitch for pointing this out)
All the numbers will fit in 64 bits(long long in C)