MCIPC Contest 1 P1 - Factoring

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Ms. Werhun was preparing factoring problems for her class when all of a sudden she spilled her tea all over her desk! Fortunately, the problems were saved, but now the answers are illegible! Your task is to help Ms. Werhun find the answers to her factoring problems.

Given two integers A and B find two integers C and D, where C + D = A and C \times D = B.

Constraints

1 \leq A, B \leq 2 \times 10^6

For each input A and B, there will always exist a C and D that will satisfy the restrictions above.

Input Specification

The first and only line of input will contain the two integers A and B separated by a space.

Output Specification

Output C and D on the same line, separated by a space.

If there are multiple solutions, output the one with the smallest value of C.

Sample Input

3 2

Sample Output

1 2

Comments

There are no comments at the moment.