本文主要是介绍LCR 177. 撞色搭配,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
LCR 177. 撞色搭配
LCR 177. 撞色搭配
迷你游戏之寻找两个单身狗
int* sockCollocation(int* sockets, int socketsSize, int* returnSize)
{int* arr = (int*)malloc(2 * sizeof(int));int ret = 0;for (int i = 0; i < socketsSize; i++){ret ^= sockets[i];}int pos = 0;for (int i = 0; i < 32; i++){if (ret & (1 << i)){pos = i;break;}}int m = 0;for (int i = 0; i < socketsSize; i++){if (sockets[i] & (1 << pos)){m ^= sockets[i];}}int n = ret ^ m;arr[0] = m;arr[1] = n;*returnSize = 2;return arr;
}
这篇关于LCR 177. 撞色搭配的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!