You are viewing a single comment's thread. Return to all comments →
Salutes from Mexico :3 !
//Complete the following function.
void calculate_the_maximum(int n, int k) { //Write your code here. int m = 0; int m1[2] ={0}, m2[2] = {0}, m3[2]= {0};
for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n ; j++) {
m1[0] = i & j; if (m1[0] >= m1[1] && m1[0] < k) { m1[1] = m1[0]; } m2[0] = i | j; if (m2[0] >= m2[1] && m2[0] < k) { m2[1] = m2[0]; } m3[0] = i ^ j; if (m3[0] >= m3[1] && m3[0] < k) { m3[1] = m3[0]; } }
} printf("%i\n",m1[1]); printf("%i\n",m2[1]); printf("%i\n",m3[1]);
}
int main() { int n, k;
scanf("%d %d", &n, &k); calculate_the_maximum(n, k); return 0;
Seems like cookies are disabled on this browser, please enable them to open this website
Bitwise Operators
You are viewing a single comment's thread. Return to all comments →
Salutes from Mexico :3 !
include
include
include
include
//Complete the following function.
void calculate_the_maximum(int n, int k) { //Write your code here. int m = 0; int m1[2] ={0}, m2[2] = {0}, m3[2]= {0};
for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n ; j++) {
} printf("%i\n",m1[1]); printf("%i\n",m2[1]); printf("%i\n",m3[1]);
}
int main() { int n, k;
}