Pair Pain Problem Code: PAIRPAIN | CodeChef Solution | Python3

Publicado em: 16 Abril 2022
no canal de: Python Coder
2,324
9

You are given an array A containing N positive integers. Find the number of pairs (i,j) such that and:

Input Format
The first line contains an integer T denoting the number of test cases. The T test cases then follow.
The first line of each test case contains an integer N.
The second line of each test case contains N space-separated integers A1,A2,…,AN.
Output Format
For each test case, output on a new line the required answer.

Sum of N over all cases won't exceed 2⋅105
Sample Input 1
2
3
1 3 4
5
2 3 4 5 6
Sample Output 1
2
0
Explanation
Test case 1: The two pairs are (1,2) and (1,3), because:

A1+A2=4 3=A1⋅A2
A1+A3=5 4=A1⋅A3
Test case 2: No pairs satisfy the condition.


Nesta página do site você pode assistir ao vídeo on-line Pair Pain Problem Code: PAIRPAIN | CodeChef Solution | Python3 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Python Coder 16 Abril 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,324 vezes e gostou 9 espectadores. Boa visualização!