Facebook
From Gracious Teal, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 168
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. public class Main
  6. {
  7.         public static void main (String[] args) throws java.lang.Exception
  8.         {
  9.                 //your code here
  10.                 Scanner sc = new Scanner (System.in);
  11.                 int n = sc.nextInt();
  12.                 int arr[]= new int[n];
  13.                 for(int i=0 ;i< n;i++){
  14.                         arr[i]=sc.nextInt();
  15.                 }
  16.  
  17.                 Arrays.sort(arr);
  18.                 for(int i=0 ;i< n ;i++){
  19.                         for(int j=i+1 ;j< n ;j++){
  20.                                 for(int k=j+1 ;k< n ;k++){
  21.                                         if(arr[j]*arr[j]==arr[i]*arr[k]){
  22.                                                 System.out.print(arr[i]+" "+arr[j]+" "+arr[k]);
  23.                                                  System.out.println();
  24.                                         }
  25.                                        
  26.                                 }
  27.                         }
  28.                 }
  29.         }
  30. }

Replies to Untitled rss

Title Name Language When
Re: Untitled Botched Kangaroo text 1 Year ago.