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

搞不好了,哪位大牛帮忙看一下啊!

Posted by 19106118 at 2006-12-09 15:08:24 on Problem 3138
In Reply To:按题目定义来... 以学校作为单位统计, 队伍只取过最多那个 Posted by:ArXoR at 2006-12-09 14:14:05
#include <stdio.h>
#include <string.h>
int main()
{
    int s,t,m,id,p,q,sid,tot,num,i;
    int school[100],c=1;
    while(EOF!=scanf("%d%d%d",&s,&t,&m))
    {
        if(s==0&&t==0&&m==0)break;
        memset(school,0,sizeof(school));
        for(i=0;i<s;i++)
        {
            scanf("%d %d %d",&id,&p,&q);
            if(p==1)school[id-1]++;
            if(q==1)school[id-1]++;
        }
        for(i=0;i<t;i++)
        {
            scanf("%d %d",&sid,&tot);
            if(tot>=m)school[sid-1]++;
        }
        num=0;
        for(i=0;i<s;i++)
        {
            if(school[i]>3)num+=3;
            else num+=school[i];
        }
        printf("Case %d: %d\n",c++,num);
    }
    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