MAXGUESS - Guess The Maximum
A cat and a rabbit are playing a simple number guessing game. The cat chose two different positive integers X and Y. He then told the rabbit several numbers. One of those numbers was X + Y and another was X - Y. The others were simply made up.
The rabbit thinks the cat prefers large numbers. Given n numbers the cat told the rabbit, print the largest possible value of X * Y
Input
Input starts with an integer T (≤ 200), denoting the number of test cases.
Each case starts with a line containing one integer N (2 ≤ N ≤ 50). Next line contains N integers. Each integer will be between 1 and 1000.
Output
For each case, print a line containing the largest possible value of X * Y.
Example
Input: 2 3 1 4 5 4 1 4 5 8 Output: 6 12
Explanation of the second case: Possible pairs (X, Y) are (3, 2) and (6, 2). The values of X * Y are 6 and 12, respectively, and the largest is 12.
Added by: | imranziad |
Date: | 2016-03-23 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | IAPC Round #1 |