题目描述:https://pycoder.blog.csdn.net/article/details/125037065
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void)
{
int c, b;
int data[10] = {0};
int index;
int *hash = NULL;
int all_tmp;
int max = 0;
scanf("%d %d %d %d %d %d %d %d %d %d %d %d",
&c, &b, &data[0], &data[1], &data[2], &data[3], &data[4],
&data[5], &data[6], &data[7], &data[8], &data[9]);
hash = (int *)malloc(sizeof(int) * b);
for (int i = 0; i < 10; i++) {
all_tmp = 0;
all_tmp += data[i] & 0xff000000;
all_tmp += data[i] & 0x00ff0000;
all_tmp += data[i] & 0x0000ff00;
all_tmp += data[i] & 0x000000ff;
index = all_tmp % b;
hash[index]++;
}
for (int i = 0; i < c; i++) {
max = fmax(max, hash[i]);
}
printf("%d\n", max);
return 0;
}