The beautiful arrays question says that :-
An array a is called beautiful if for every pair of numbers ai, aj, (i ≠ j), there exists an ak such that ak = ai * aj. Note that k can be equal to i or j too.
Find out whether the given array a is beautiful or not!
Input Format:- First line of the input contains an integer T denoting the number of test cases. T test cases follow.
First line of each test case contains an integer n denoting number of elements in a.
Next line contains n space separated integers denoting the array a.
My code is this:-import java.util.;
import java.lang.;
import java.io.*;
class Array{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
long x;
int t = scan.nextInt();
for(int i=0; i<t; i++) {int count=0;
int n= scan.nextInt();
for(int j=0; j<n; j++) {
x=scan.nextLong();
if(x!=0 && x!=1) {count++;}
}
if(count>1 ) System.out.println("no");
else System.out.println("yes");
}
scan.close();
}
}
I am not able to find the bug in the code… please help!!!