95. 公平分禮物

 avatar
user_6817964
c_cpp
2 years ago
375 B
0
Indexable
Never
#include <stdio.h> // printf
int main()
{
	int n, k, c[107], sum[101];
	scanf_s("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf_s("%d", &c[i]);;
	}

	int total = 0;

	for (int j = 0; j <= 100; j++) {
		sum[j] = 0;
		for (int i = 1; i <= n; i++) {
			if (c[i] == j) {
				sum[j]++;
			}
		}
		total += (sum[j] / k);
	}

	printf("%d", total);

}