Submit | All submissions | Best solutions | Back to list |
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-03-14 11:59:18 sumit jha
Time limit should be increased ,I have got time exceeded 3 times even after removing many compulsory tests |
||||||||||||||
2012-03-14 04:23:36 Devil D
@ Mitch - Thanks for ur Inputs... I did few Rejudges because there was some problem with the Judging ... I moved to 'Exact Judge' and all sols went WA. then moved to 'Ignore white spaces'. My test cases had around 30 -70 test cases but the sol was checking for only 5 in all , so modified the test cases @ Sachin - Yes it is an easy problem. I am not sure should i move this to Tutorial or not. i have seen easier and simple Formula related problems here. @ Numerix - i changed the time limit after i reduced the number of test cases in each file from 30-70 to 1-5 and i set the values based on how much my solution was taking time .If you still think it strict i can modify that Last edit: 2012-03-14 04:25:32 |
||||||||||||||
2012-03-14 02:19:22 Mitch Schwartz
The test cases are weak. As the problem is written, any code should be able to pass this input: 2 144115188075855890 144115188075856304 7349874591868660947 144115188075856304 144115188075855890 7349874591868660947 Also, see numerix's comment regarding time limit. I think you're not supposed to make time limits less than 0.5s, but I've seen at least one older problem get away with it (FLOWGROW), so I'm not completely sure. I counted 4 rejudges in a short time after the problem was published. This seems to me rather extreme.. In the future, please take a little more time to test before publishing. Thanks. |
||||||||||||||
2012-03-13 20:27:59 Sachin Railhan
Should be moved to tutorials.Very easy Prob |
||||||||||||||
2012-03-13 12:44:02 numerix
Time limit is too strict for some languages because of interpreter startup time. |