2048.Display Size

Time Limit: 1s Memory Limit: 256MB

A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels.

Your task is to determine the size of the rectangular display - the number of lines (rows) of pixels a and the number of columns of pixels b, so that:
there are exactly n pixels on the display; the number of rows does not exceed the number of columns, it means a \le b; the difference b-a is as small as possible.

Input Format(From the terminal/stdin)

The first line contains the positive integer n (1 \le n \le 106)- the number of pixels display should have.

Output Format(To the terminal/stdout)

Print two integers- the number of rows and columns on the display.

Sample Input 1

Copy
8
 \n

Sample Output 1

Copy
2 4
 · \n

Sample Input 2

Copy
64
  \n

Sample Output 2

Copy
8 8
 · \n

Sample Input 3

Copy
5
 \n

Sample Output 3

Copy
1 5
 · \n

Sample Input 4

Copy
999999
      \n

Sample Output 4

Copy
999 1001
   ·    \n

Hints

In the first example the minimum possible difference equals 2, so on the display should be 2 rows of 4 pixels.

In the second example the minimum possible difference equals 0, so on the display should be 8 rows of 8 pixels.

In the third example the minimum possible difference equals 4, so on the display should be 1 row of 5 pixels.

Submit

请先 登录

© 2025 FAQs