#C5977. Maximum Product of Three Numbers
Maximum Product of Three Numbers
Maximum Product of Three Numbers
Given an array of integers, your task is to compute the maximum product that can be obtained from any three integers from the array.
In other words, if the array is \( A = [a_1, a_2, \dots, a_n] \), you need to find the maximum value of \( a_i \times a_j \times a_k \) for all distinct indices \( i, j, k \).
The solution should correctly handle negative numbers. Recall that the maximum product can come from either the product of the three largest numbers or the product of the two smallest (possibly negative) numbers and the largest number.
inputFormat
The input is provided via standard input (stdin) as a single line containing space-separated integers.
You can assume that the array will contain at least three integers.
outputFormat
Output the maximum product of any three numbers from the given array on standard output (stdout).
## sample1 10 2 6 5 3
300