-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay34.java
More file actions
19 lines (19 loc) · 742 Bytes
/
Copy pathDay34.java
File metadata and controls
19 lines (19 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.*;
public class Day34{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the number of Test Cases");
int size = in.nextInt();
for (int i=0;i<size ;i++ ) {
System.out.println("Enter the no of sticks in Test Case "+(i+1));
int num = in.nextInt();
int sticks[] = new int[num];
System.out.println("Enter the sizes of "+num+" sticks");
for (int j=0;j<num ;j++ ) {
sticks[j] = in.nextInt();
}
Arrays.sort(sticks);
System.out.println("The highest area can be found by taking a stick with length "+sticks[sticks.length-1]+" and "+sticks[sticks.length-2]+" which will give area of "+sticks[sticks.length-1]*sticks[sticks.length-2]);
}
}
}