PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000211. Liệt kê các thương nguyên phân biệt (Enumerate Quotients)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Liệt kê các thương nguyên phân biệt (Enumerate Quotients)
Liệt kê các thương nguyên phân biệt (Enumerate Quotients)
Source: Library Checker
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , define the set
$$S=\left\{\left\lfloor\frac{N}{i}\right\rfloor\mid i\in\mathbb Z,\ 1\le i\le N\right\}.$$Print every distinct member of in strictly ascending order.
Input
One line contains .
Output
Print on the first line. On the next line print the values in strictly increasing order.
Subtasks
-
Subtask 1 (20 points): .
-
Subtask 2 (30 points): .
-
Subtask 3 (50 points): .
Examples
Example 1
Input
10
Output
5
1 2 3 5 10
Explanation
The quotients for indices 1 through 10 are 10, 5, 3, 2, 2, 1, 1, 1, 1, 1. Remove duplicates and print ascending.
Example 2
Input
1
Output
1
1
Explanation
There is exactly one index, so the only quotient is 1.