[Solution] Good Pairs CodeChef Solution | Solution CodeChef
Problem
You are given an array of length .
A pair is said to be good if . Here denotes the greatest common divisor and denotes least common multiple.
Find the total number of good pairs present in the given array.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- The first line of each test case contains an integer - the length of the array .
- The second line of each test case contains space-separated integers .
Output Format
For each test case, output on a new line the total number of such good pairs possible in the given array.
👇👇👇👇👇
Explanation:
Test case : No good pair is present.
Test case : The good pairs are: and . To elaborate, .
Test case : The good pairs are: and . To elaborate, .
Test case : The good pair are: and . To elaborate, .
Test case : No good pair is present.
No comments:
Post a Comment