#C14727. Triplet Cubes Sum
Triplet Cubes Sum
Triplet Cubes Sum
Given an array of integers, determine whether there exists a triplet of distinct elements (a, b, c) such that their cubes satisfy the equation $$a^{3} + b^{3} = c^{3}$$. In other words, you need to check if there exist indices i, j, k (all distinct) for which the equation holds. This problem requires a brute-force search over the array elements. The input will be provided via standard input and the result should be printed to the standard output as either True
or False
.
inputFormat
The first line contains an integer n representing the number of elements in the array. The second line contains n space-separated integers.
outputFormat
Output True
if there exists a triplet (a, b, c) such that $$a^{3}+b^{3}=c^{3}$$; otherwise, output False
.
6
1 2 3 4 5 6
False