mpt.c (421B)
1 #include <stdio.h> 2 3 int solution(int *, int N); 4 5 int 6 main(void) 7 { 8 int A[] = {-3, 1, 2, -2, 5, 6}; 9 10 printf("%d", solution(A, 6)); 11 12 return 0; 13 } 14 15 int 16 solution(int *A, int N) 17 { 18 int res; 19 20 res = A[0] * A[1] * A[2]; 21 for (int i = 0; i < N; i++) { 22 for (int j = i+1; j < N; j++) { 23 for (int k = j+1; k < N; k++) { 24 if ((A[i] * A[j] * A[k]) > res) { 25 res = (A[i] * A[j] * A[k]); 26 } 27 } 28 } 29 } 30 31 return res; 32 } 33