Home > Back-end >  Ask (a | b) (kathi Jones from a&b) maximum
Ask (a | b) (kathi Jones from a&b) maximum

Time:10-04

CodePudding user response:

Just two for loop iterate through all the two combination, to find the maximum,
Int main () {
Int n, I, j, m, t, * a;
The scanf (" % d ", & amp; N);
A=(int *) malloc (sizeof (int) * n);
for(i=0; iThe scanf (" % d ", & amp; A [I]);
}
M=0;
for(i=0; iFor (j=I + 1; jT=(a [I] | a [j]) + (a [I] & amp; A [j]);//a [I] and a [j] the combination of
If (t> M m=t);//m to save the maximum
}
}
Printf (" % d ", m);
free(a);
return 0;
}
  • Related