#SP0000273. Phân tích một số thành thừa số nguyên tố (Factorize)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Phân tích một số thành thừa số nguyên tố (Factorize)
Factorize
Source: Library Checker
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , factorize it into prime numbers. List each prime as many times as its multiplicity, in nondecreasing order. The integer has no prime factors.
Input
One line contains the positive integer .
Output
Print exactly one line containing , the number of prime factors of counted with multiplicity, followed by the prime factors in nondecreasing order, separated by spaces. If , print only 0.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
1
Output
0
Explanation
The input is . Since has no prime factors, the number of prime factors counted with multiplicity is . The program prints 0.
Example 2
Input
60
Output
4 2 2 3 5
Explanation
Starting from , divide successively by prime factors: ; ; ; . The factors in nondecreasing order are ; there are factors counting repetitions. Thus print 4 2 2 3 5.
Example 3
Input
756
Output
6 2 2 3 3 3 7
Explanation
Starting from , divide successively by prime factors: ; ; ; ; ; . The factors in nondecreasing order are ; there are factors counting repetitions. Thus print 6 2 2 3 3 3 7.