Facebook
From Botched Kangaroo, 1 Year ago, written in Plain Text.
This paste is a reply to Untitled from Gracious Teal - go back
Embed
Viewing differences between Untitled and Re: Untitled
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
        public static void main (String[] args) throws java.lang.Exception
        {
                //your code here
                Scanner sc = new Scanner (System.in);
                int n = sc.nextInt();
                int arr[]= new int[n];
                for(int i=0 ;i< n;i++){
                        arr[i]=sc.nextInt();
                }

                Arrays.sort(arr);
                for(int i=0 ;i< n ;i++){
                        for(int j=i+1 ;j< n ;j++){
                                for(int k=j+1 ;k< n ;k++){
                                        if(arr[j]*arr[j]==arr[i]*arr[k]){
                                                System.out.print(arr[i]+" "+arr[j]+" "+arr[k]);
                                                 System.out.println();
                                        }
                                       
                                }
                        }
                }
        }
}