Giving correct answer in ideone but while submitting the solution it is showing wrong answer.what is the problem in below code?
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
class sample3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
ArrayList<Integer>a=new ArrayList<>();
for(int i=0;i<t;i++){
a.removeAll(a);
int n=sc.nextInt();
int x=sc.nextInt();
int y=sc.nextInt();
if(x<n&&x/y==0){
for(int j=1;j<n;j++){
int m=j*x;
if(m%x==0&&m%y!=0){
if(m<n){
a.add(m);
}
}
}
}
Collections.sort(a);
for(Integer p:a){
System.out.print(p+" ");
}
System.out.println();
}
}
}