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
[Lakshman]: 2013-01-28 16:48:45

@Devil D PLEASE CHECK
I am getting WA can you please check my code submission no 8605184...

Last edit: 2013-01-28 17:10:48
gaurav: 2013-01-23 21:32:07

&devil..
can u plz tell me no. of test cases i failed..

Last edit: 2013-02-05 03:09:03
Ouditchya Sinha: 2013-01-13 14:25:14

Finally AC :) ( After 30 WA + TLE ) phew...

Last edit: 2013-01-30 16:12:43
Himanshu: 2012-12-21 13:43:38

TELL ME WHY GIVES WA ID IS:8316209
THANKS IN ADVANCE

gourav: 2012-11-10 07:54:26

nice question... but my problem wasn't any good.. again, as AP2 i was not printing n in the o/p hell... it cost me 1 hour... :'(

Aayush Bahuguna: 2012-10-01 00:45:13

sqrt(x) is float in python and have limited precision
Try int(sqrt(x)) which will get you AC :)

akb: 2012-09-16 12:59:57

I hate nasty precision and/or I/O optimization type questions....

theChosenOne: 2012-09-15 10:58:33

Don't judge a problem just by the simplicity of it ;-)

Zhiang: 2012-08-17 18:26:26

even the given test case fails on my system,but got AC :)
quite weird.
guess dev c++ doesnt support Lf

Rohit: 2012-06-23 12:28:08

finally got AC..:))


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