PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000268. Lũy thừa của số nguyên tố (Prime Power)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Lũy thừa của số nguyên tố (Prime Power)
Prime Power
Source: VNOJ
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is a prime power of exponent greater than one if for a prime number and an integer .
Given , determine whether such exist. If they exist, print them; otherwise print .
Input
One line contains a positive integer .
Output
If with prime and , print p q on one line; otherwise print 0.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
27
Output
3 3
Explanation
and is prime, with exponent . Hence print 3 3.
Example 2
Input
10
Output
0
Explanation
has two distinct prime factors, so no such prime power representation exists. Print 0.
Example 3
Input
64
Output
2 6
Explanation
. Although , is not prime; the required pair is 2 6.