House Numbers
InterviewTime limit1sMemory limit512 MB
Given the first house number m, find the smallest n and the house x whose left and right neighbours' numbers sum equally.
- Level
Medium5 of 10
- Topics
- Math, Number theory, Brute force, Implementation
- Solved
- No attempts yet
Problem
Peter was walking down the street and noticed that the houses on the street were numbered consecutively from to . Standing in front of a particular house , he also noticed that the sum of the house numbers behind him (numbered from to ) was equal to the sum of the house numbers in front of him (numbered from to ).
Given , and assuming there are at least three houses, find the smallest for which this is possible.
Input
The input consists of a single line containing the integer ().
Output
On a single line, print , , and , in that order, separated by spaces.
It is guaranteed that a solution exists with .