AP2 - AP - Complete The Series (Easy)

Arithmetic and geometric Progressions are 2 of the well known progressions in maths.

Arithmetic progression (AP) is a set in which the difference between 2 numbers in constant. for e.g., 1, 3, 5, 7, 9 ... In this series the difference between 2 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 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', '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.

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

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

Example

Input:
1
3 8 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:1500B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own

hide comments
2012-08-02 15:33:03 Udit Kumawat
working right in ideone and in this giving wrong answer
2012-06-29 13:07:46 Sanchit Manchanda
id- 7232980
pls tell me test case my solution is giving wrong answer

Edit- AC :D

Last edit: 2012-06-29 13:12:04
2012-05-17 07:09:39 numerix
Thanks for increasing the time limit. A Python 2.5 solution can pass now.
2012-05-16 09:53:19 Devil D
INCREASED THE TIME LIMIT A LITTLE BIT
HOPE THAT HELPS
2012-05-15 15:42:27 david_8k
Time limit way too strict. If you want to "increase the time limit", please, make a decent generator for a lot of cases, so you can increase the time limit, solving then the problem of interpreted languages...
2012-05-07 15:41:03 hell
some test cases plzzz
2012-04-06 04:21:33 rahul singh
tle.. how can i optimize it..i am just assigning values to the variable (after solving the 3 equations)..pls help!!!
2012-04-03 00:01:40 DivineAtheist
got AC....:)....nice problem....:)just a littile bit of trick involved..:)
2012-03-21 15:57:39 numerix
@Devil D: Time limit is definitely too strict to be passed by some interpreted languages. I don't think it makes that (easy) problem even more easy, if time limit will be set to a higher value.

Last edit: 2012-03-21 15:58:06
2012-03-19 21:08:40 Gunjit
getting run time error any idea??
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.