Sum
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Vovochka, known for his love of creating math problems, recently devised this challenge: Given an integer s, identify all positive integer pairs a and b such that a ≤ b and
a + (a + 1) + (a + 2) + ... + (b - 1) + b = s
Input
A single integer s (1 ≤ s ≤ 10^12
).
Output
The first line should display a single integer k, representing the number of pairs a and b found. The following k lines should each contain two integers, where the first is not greater than the second, representing the pair. List the pairs in ascending order based on the first integer.
Examples
Input #1
Answer #1
Submissions 329
Acceptance rate 27%