AP3 - AP - Complete The Series v2

no tags 

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 & 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.

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
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)

hide comments
J_P: 2013-12-15 08:14:59

my 1st code in python.... finally accepted after so many WA in c++....:) :P

Aayush Moroney: 2013-12-13 13:05:27

AC :),after 3 WA...

mystique_blue: 2013-08-09 11:48:04

+1 ouditchya

Anubhav Balodhi : 2013-07-29 17:26:09

i got 9 wa, then ac in 0.02 sec ^_^ there was overflow(both of emotions and integer)...
it taught me a lot about correctly using data-type for variable...

pika_pika: 2013-07-19 20:24:57

frustrated of WA after 8th test case. Did it python ,AC in 1st attempt. Definitely
there is a precision problem if you get WA.

Hasil Sharma: 2013-07-17 12:26:46

Very nice problem :) , learnt a lot

Agnisnato Datta: 2013-07-04 06:23:29

i am constantly getting wrong ans at the 8th test case...please can anyone help me out Id:9600755

Last edit: 2013-07-04 06:23:43
Ouditchya Sinha: 2013-06-24 19:16:58

@encrypted: You don't need BigInt Class to solve this problem in C/C++. This problem has many precision issues which should be carefully handled. Rest is straight forward. e.g. use sqrtl instead of sqrt,ceill,floorl,llrintl of <cmath> in C++. Use doubles & convert to long long when required. :)

Chandan Mittal: 2013-06-22 08:40:00

just cant understand how so many people got AC in 0.00 that too in C/C++
Did you guys make your own BigInt class for that??

W.A.P to: 2013-05-30 09:47:02

whats test case 8??? cost m 7 wa??? still no ac... help..


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