int cmp(const void*a,const void *b){
return *(int*)a-*(int*)b;
}
int distributeCandies(int* candies, int candiesSize){
if(candiesSize==2)return 1;
qsort(candies,candiesSize,sizeof(candies[0]),cmp);
int count=1;
for(int i=0;i<candiesSize-1;i++){
if(candies[i]!=candies[i+1])count++;
if(count==candiesSize/2)break;
}
return count;
}
08-16
08-16