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


hide comments
Gautam Kumar: 2014-08-10 09:11:36

I can't find why i am always getting wrong answer.

Last edit: 2014-09-09 10:11:57
derp: 2014-07-02 18:10:07

ive tried everything but still its giving me a WA ;'( help me out ..rounding off using ceil nd llrntl dint work for me ..
;(

Ranjan Kumar Singh: 2014-07-01 09:35:53

17 WA then checked forum and got AC...most difficult problem to submit just use decimal every where like 2.0 for any operation and use sqrtl

Sankaranarayanan G: 2014-06-14 09:13:39

this problem is abt precision. be careful of the datatype and convert to long long whenever required

agaurav77: 2014-06-06 18:46:20

Really, there are just precision problems,if you are getting WA, and everything seems right.

If you are using long long in C, then use double instead, and use sqrtl instead of sqrt. AC finally!

`Ak: 2014-05-15 20:17:43

WTF!!!! a very silly mistake costed me 10 WA :( :(
at last got AC :) :)

Gautam Kumar: 2014-03-03 17:08:12

@Devil D
Kindly check my solution and tell for which value it is giving WA.
My id is 11176619.
2nd id is 11176489.
Plz check and reply ASAP.

Last edit: 2014-03-03 17:09:21
Sameer: 2014-02-14 13:31:40

+1 Ouditchya.

Abhinav Gupta: 2014-01-19 12:54:48

This problem is all about precisions..Forum helped me!!

Bhavik: 2013-12-26 18:33:19

read Ouditchya comment...:))


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