Company: Tesco SDE offcampus_20july
Difficulty: easy
Write a program that prints all the numbers within the given range (S, E) , inclusively, that can be expressed as the sum of X consecutive positive integers. Read the input from STDIN and print the output to STDOUT. Do not print arbitrary strings anywhere in the program, as these contribute to the output and test cases will fail. Constraints 1 ≤ S ≤ E ≤ 900000 1 < X ≤ 1000 Input Format The input line will consist of three integers S , E and X representing the start range, end range, and number of consecutive numbers, each separated by a single white space. Output Format The output should print all numbers in ascending order that satisfy the condition, separated by a single space. If no number in the range satisfies the condition, print nothing. Sample Input 1 10 20 3 Sample Output 1 12 15 18 Explanation 1 Here, the given value of X is 3. So, the sums of three consecutive positive numbers within the given range (10 and 20) are 12 (12 = 3+4+5), 15 (4+5+6) and 18 (5+6+7). S