PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000234. Đếm cặp có tích là lũy thừa bậc k (Power Products)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm cặp có tích là lũy thừa bậc k (Power Products)
Đếm cặp có tích là lũy thừa bậc k (Power Products)
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers and , count pairs whose product is a perfect -th power.
Input
- First line: .
- Second line: integers .
Output
Print the number of qualifying pairs.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
6 3
1 3 9 8 24 1
Output
5
Explanation
Exactly five pairs have a product that is a perfect cube.
Example 2
Input
2 2
2 8
Output
1
Explanation
The product is .