COCI '16 Contest 7 #2 Uzastopni

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem types

Output all the ways in which a given positive integer N can be obtained as the sum of several (two or more) consecutive positive integers.

Input Specification

The first line of input contains the positive integer N (3 \le N \le 10^{10}).

Output Specification

For each sum of consecutive positive integers that is equal to N, in one line output the first and the last addend. The order of lines in the output is not important. In each test case, at least one corresponding sum will exist.

Sample Input 1

10

Sample Output 1

1 4

Explanation of Sample Output 1

10 = 1 + 2 + 3 + 4.

Sample Input 2

27

Sample Output 2

13 14
8 10
2 7

Comments

There are no comments at the moment.