| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
有时AC……有时RE……还有时TLE……#include <stdio.h>
#include <string.h>
int child[1000009] = {0};
int main() {
int n, d, i, c, ans = 0, max = 0;
scanf("%d%d", &n, &d);
for(i = 0; i < n; i++){
scanf("%d", &c);
if(c > max)
max = c;
child[c]++;
}
for(i = 0; i <= max; i++)
if(child[i] > d)
ans += (child[i] - 2) / (d - 1);
printf("%d\n", ans);
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator