Skip to content

Commit 2897ca8

Browse files
authored
Add problem 2
Added problem description
1 parent 7f7e501 commit 2897ca8

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## Problem Description
2+
3+
You are given an integer `n` and an integer `k` (`k ≥ 2`), along with an array of `n` positive integers
4+
`a1, a2, ..., an`.
5+
6+
Your task is to count the number of unordered index pairs `(i, j)` such that:
7+
8+
- `1 ≤ i < j ≤ n`
9+
- The product `ai × aj` is a **perfect k-th power**
10+
11+
A number is called a perfect k-th power if it can be written in the form `x^k` for some integer `x`.
12+
13+
---
14+
15+
## Input Format
16+
17+
- The first line contains two integers `n` and `k`.
18+
- The second line contains `n` integers `a1, a2, ..., an`.
19+
20+
---
21+
22+
## Output Format
23+
24+
- Print a single integer — the number of valid pairs `(i, j)`.
25+
26+
---
27+
28+
## Constraints
29+
30+
- `2 ≤ n ≤ 100000`
31+
- `2 ≤ k ≤ 100`
32+
- `1 ≤ ai ≤ 100000`
33+
34+
---
35+
36+
## Sample Input
37+
38+
```
39+
6 3
40+
1 3 9 8 24 1
41+
```
42+
---
43+
44+
## Output
45+
46+
```
47+
5
48+
```
49+
50+
[PROBLEM LINK]( https://codeforces.com/problemset/problem/1225/D)

0 commit comments

Comments
 (0)