#t66. 三数最值
三数最值
Min-Max of Three Numbers
Problem Description
Given a positive integer . Among all triples of three distinct positive integers that sum to , find:
- : the smallest possible value of the largest of the three numbers;
- : the largest possible value of the smallest of the three numbers.
For example, when , choosing makes the largest number as small as , and the smallest number as large as .
Input Format
A single positive integer ().
Output Format
Output two positive integers and , separated by a single space. If no such triple exists, output -1 -1.
Sample Input 1
3
Sample Output 1
-1 -1
Sample Input 2
6
Sample Output 2
3 1
Sample Input 3
17
Sample Output 3
7 4
Hint
- Note that they are distinct positive integers.
- The programming approach may differ from the mathematical reasoning in the statement; you can also find the answer directly by enumerating with loops.