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)
hide comments
vivekt_007:
2016-06-06 14:34:42
easy one :)
|
|
Tushar Singh:
2016-05-31 18:44:00
Can someone illustrate whats wrong with first finding quadratic in n, solving using quadratic root formula instead of first term + last term approach
|
|
Rishabh Gupta:
2016-05-14 15:08:45
School level maths problem :)....piece of cake
|
|
ov3rk1ll:
2016-02-18 12:42:12
getting tle in java :( no loops used |
|
gj21:
2016-02-14 06:11:30
how stupid can a person be..surely not more than me finally AC! (-_-') |
|
wh1t3_r0s3:
2016-01-18 17:45:45
a very easy question.just a bit of insight in maths is required.AC in first go |
|
darkhire21:
2016-01-06 22:37:58
there is no testcase yet in which T3 == T(n-2) ...!! Last edit: 2016-01-06 22:38:12 |
|
phuhiep11395:
2015-12-23 09:59:24
@utkarsh5
|
|
frillyfrufru:
2015-12-19 14:35:43
0.1 sec isn't long enough to load Java. |
|
utkarsh5:
2015-12-19 10:34:09
The test case
|
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 |