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 |
搞不好了,哪位大牛帮忙看一下啊!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator