#t66. 三数最值

三数最值

Min-Max of Three Numbers

Problem Description

Given a positive integer nn. Among all triples of three distinct positive integers that sum to nn, find:

  • xx: the smallest possible value of the largest of the three numbers;
  • yy: the largest possible value of the smallest of the three numbers.

For example, when n=10n = 10, choosing 2,3,52, 3, 5 makes the largest number as small as 55, and the smallest number as large as 22.

Input Format

A single positive integer nn (0<n<100000 < n < 10000).

Output Format

Output two positive integers xx and yy, 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

  1. Note that they are 33 distinct positive integers.
  2. The programming approach may differ from the mathematical reasoning in the statement; you can also find the answer directly by enumerating with loops.