Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

有时AC……有时RE……还有时TLE……

Posted by a_team at 2007-09-23 13:22:57 on Problem 3385
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator