#K44372. Pair with Target Product
Pair with Target Product
Pair with Target Product
You are given an array of integers and a target integer \(T\). Your task is to determine whether there exists any pair of distinct elements in the array such that the product of the two elements is exactly equal to \(T\). Note that even if the same number appears multiple times in the array, using two identical numbers is not allowed; the two numbers must be different.
For example, given the array [1, 2, 3, 4, 5] with \(T = 8\), one valid pair is 2 and 4 because \(2 \times 4 = 8\). However, for the array [5, 5, 5, 5, 5] with \(T = 25\), even though 5 appears multiple times, selecting two 5s is not permitted and the answer should be "NO".
inputFormat
The input is read from stdin and consists of two lines:
- The first line contains two integers \(n\) and \(T\), where \(n\) is the number of elements in the array and \(T\) is the target product.
- The second line contains \(n\) integers separated by spaces, representing the elements of the array.
outputFormat
Output a single line to stdout containing "YES" if there exists a pair of distinct elements whose product equals \(T\), otherwise output "NO".
## sample5 8
1 2 3 4 5
YES