AP3 - AP - Complete The Series v2

After solving "AP - Complete The Series (easy)" very fast, Lucifer decided to make it little more interesting.

He said

He will be give you the 3rd term, 4th last term and the sum of the AP series. You need print length of the series and 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' ,'4Lastterm' and 'sum'

3termĀ  - is the 3rd term in the series and

4LasttermĀ  - is the 4th last term in the series and

sum - is the sum of the series.

Output

For each input of the test case, you need to print 2 lines.

first line should have 1 value - number of terms in the series.

second line of the output should print the series numbers separated by single space.

Example

Input:
1
3 7 55

Output:
10
1 2 3 4 5 6 7 8 9 10

NOTE

In all the test cases all the series elements are positive integers.

The series will have at least 7 elements.

Number of test cases <=100.

All the numbers will fit in 64 bits (long long in C)


Added by:Devil D
Date:2012-03-13
Time limit:0.100s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own

hide comments
2015-06-06 16:39:21 Avinab saha
tricky question as per precisions are concerned........ use double for calculations,and use sqrtl instead of sqrt :)
2015-04-18 15:45:13 Abhishek Naik
I got the fact that it is a precision issue - but which is that particular test case for which it breaks?
2014-12-20 18:37:54 eightnoteight
4Lastterm - is the 4th term in of the series and

please correct this line!!

(reply by Min_25)
corrected.

Last edit: 2014-12-20 19:29:09
2014-12-18 14:27:08 Piyush Kumar
am getting WA at 7th test case.. HELP??
2014-10-26 04:04:20 ROHIT RAJ
learned something new :)
2014-10-08 14:05:10 Arko
Wow !! Learnt a new thing about truncating spaces with help of %s format specifier in C !!
2014-10-07 14:19:51 Unknown
[code removed]
can anyone tell me wat is wrong with my code. i am getting wrong answer


Last edit: 2016-01-01 01:26:17
2014-10-05 21:25:42 Shankar Chaudhary
can anyone help me i am getting wa
i got quadratic and get two solution i checked both still wa
my id is 12546036

Last edit: 2014-10-05 21:27:27
2014-09-16 12:30:25 arjundabra
please check my code getting wa at running(7)
id 12385627
2014-09-11 18:08:55 albertg
you don't need any doubles, big numbers and hard algebra, everything is more simple ...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.