#K34132. Longest Consecutive Sum Sequence
Longest Consecutive Sum Sequence
Longest Consecutive Sum Sequence
Given a target integer \(T\), find the longest sequence of consecutive positive integers such that their sum equals \(T\). If there are multiple sequences of the same maximum length, return any one of them. If no such sequence exists (for example, when \(T \le 0\)), output an empty result.
The sum \(S\) of a sequence starting from \(a\) with \(n\) consecutive numbers is given by the formula:
Your task is to determine the sequence with maximum length that satisfies \(S = T\).
inputFormat
The input is provided through standard input. The first and only line contains a single integer \(T\), representing the target sum.
outputFormat
Print the sequence of consecutive integers that sums to \(T\) on a single line, with each number separated by a space. If no valid sequence exists, output an empty line.
## sample15
1 2 3 4 5
</p>