#P1147. 连续自然数和
连续自然数和
Description
Given a positive integer , find all segments of consecutive positive integers (each segment must contain at least two numbers) whose sum is .
Example: , so the segment from to is a solution for .
Input Format
A single line containing an integer giving the value of ().
Output Format
Output one line per solution, containing two positive integers: the first and last numbers of a valid consecutive positive integer segment, separated by a space. Sort all lines by the first number in ascending order. For the given input, at least one solution exists.
10000
18 142
297 328
388 412
1998 2002
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号