TopCoder

User's AC Ratio

100.0% (3/3)

Submission's AC Ratio

72.7% (8/11)

Tags

Description

給定正整數 $K$ ,請找出所有正整數對 $(a,b)$ 滿足 $a \le b$ 且 $\frac{1}{a} + \frac{1}{b} = \frac{1}{K}$ 。

Input Format

輸入有一行,包含一個正整數 $K$。

  • $1 \le K \le 10^ 6$

Output Format

對於每一個可能的 $(a, b)$ 輸出一行,這一行有兩個用空格分隔正整數分別代表 $a$ 和 $b$ 。輸出的解請照 $a$ 的大小由小到大排序。

Sample Input 1

2

Sample Output 1

3 6
4 4

Sample Input 2

4

Sample Output 2

5 20
6 12
8 8

Hints

Problem Source

UVA 10976

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~31 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 524288 65536 1 2
1 1000 524288 65536 1 2
2 1000 524288 65536 2
3 1000 524288 65536 2
4 1000 524288 65536 2
5 1000 524288 65536 2
6 1000 524288 65536 2
7 1000 524288 65536 2
8 1000 524288 65536 2
9 1000 524288 65536 2
10 1000 524288 65536 2
11 1000 524288 65536 2
12 1000 524288 65536 2
13 1000 524288 65536 2
14 1000 524288 65536 2
15 1000 524288 65536 2
16 1000 524288 65536 2
17 1000 524288 65536 2
18 1000 524288 65536 2
19 1000 524288 65536 2
20 1000 524288 65536 2
21 1000 524288 65536 2
22 1000 524288 65536 2
23 1000 524288 65536 2
24 1000 524288 65536 2
25 1000 524288 65536 2
26 1000 524288 65536 2
27 1000 524288 65536 2
28 1000 524288 65536 2
29 1000 524288 65536 2
30 1000 524288 65536 2
31 1000 524288 65536 2