Problem Description:
The right-hand code is to combine 6 integers in any order to calculate the maximum number that can be combined.
For example: The 4123,25,66 combination is 66412325.
Please read the program completion code to achieve this function
Code:
#include <stdio.h>
Long long max (long long x, long long y) {
return x > Y x:y;
}
Long long test (int a[], int n) {
long long ret = 0;
for (int i = 0; i < n; ++i) {
int tp = A[i];
int j = 1;
while (TP) {
J *=;
TP/=;
}
RET = ret * j + a[i];
}
return ret;
}
Long long f (int a[], int k) {
if (k = = 6) {
return Test (A, k);
}
Long long ret = 0;
for (int i = k; i < 6; ++i) {
int t = a[k];
A[K] = A[i];
A[i] = t;
RET = max (ret, /* Fill in the necessary code here */);//Fill in F (a,k+1)
t = a[k];
A[K] = A[i];
A[i] = t;
}
return ret;
}
int main () {
int a[6] = {517, 283, 429, N, 6566, +};
printf ("%lld\n", f (A, 0));
return 0;
}