PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000195. Phân tích thành dãy chia hết (Number into Sequence)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phân tích thành dãy chia hết (Number into Sequence)
Phân tích thành dãy chia hết (Number into Sequence)
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given , construct of integers greater than with product and for all adjacent indices. Maximize the length ; any optimal sequence is accepted.
Input
One integer .
Output
Print the optimal length , then the sequence of values.
Subtasks
-
Subtask 1 (20 points): .
-
Subtask 2 (30 points): .
-
Subtask 3 (50 points): .
Examples
Example 1
Input
360
Output
3
2 2 90
Explanation
The product is and the divisibility chain is valid. The maximum prime exponent of is three, proving optimality.
Example 2
Input
2
Output
1
2
Explanation
Since is prime, the only possible sequence has one element.
Example 3
Input
36
Output
2
2 18
Explanation
The sequence has product and respects ; the maximum prime exponent in is two.