PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000270. Phân tích N thành bình phương nguyên tố (Happy New Year 2023)
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 N thành bình phương nguyên tố (Happy New Year 2023)
Happy New Year 2023
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
You are given a positive integer . It is guaranteed that there are two distinct primes and such that .
Find and . The required pair is unique under the problem guarantee.
Input
One line contains the positive integer .
Output
Print the two primes and , separated by one space, in the correct order for .
Subtasks
- Subtask 1 (20 points): ; there exist distinct primes with .
- Subtask 2 (30 points): ; there exist distinct primes with .
- Subtask 3 (50 points): ; there exist distinct primes with .
Examples
Example 1
Input
2023
Output
17 7
Explanation
. Both factors are distinct primes; the squared factor must be printed first, giving 17 7.
Example 2
Input
63
Output
3 7
Explanation
is divisible by both and . Dividing by leaves , so with distinct primes; therefore print 3 7.
Example 3
Input
1059872604593911
Output
104149 97711
Explanation
. These are distinct primes; print the squared base first as 104149 97711.