33,008
社区成员
发帖
与我相关
我的任务
分享
Type find(Type * ID, int N)
{
int nTimes = 0;
int i;
Type candidate;
for (i = 0; i < N; i++)
{
if (nTimes == 0)
{
candidate = ID[i];
nTimes++;
}
else
{
if (candidate == ID[i])
nTimes++;
else
nTimes--;
}
}
return candidate;
}