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 |
不知哪错了,好郁闷呀!! 那位好心人儿给看看,先在这谢了啊#include<stdio.h> #include<stdlib.h> #include<string.h> //不知错哪里呀 !!!!!!!! struct Team { int n; //统计过题数量 __int64 time; //统计时间 int num; //队的编号 }; Team d[1002]; int t[1002][22]; //统计通过前提交的次数 int cmp(const void *a,const void *b) { Team *p=(Team*)a,*q=(Team*)b; if(p->n!=q->n) return q->n-p->n; else if(p->time!=q->time) return p->time-q->time; else return p->num-q->num; } int main() { int nteam,n; int i,j; int te,q,ti,b; while(scanf("%d %d",&nteam,&n)!=EOF) { memset(t,0,sizeof(t)); for(i=1;i<=nteam;i++) { d[i].n=d[i].time=0; d[i].num=i; } for(i=0;i<n;i++) { scanf("%d %d %d %d",&te,&q,&ti,&b); if(b==0) { if(t[te][q]!=-1) t[te][q]++; } else { if(t[te][q]!=-1) { d[te].n++; d[te].time+=(__int64)(ti+20*60*t[te][q]); t[te][q]=-1; } } } qsort(d+1,nteam,sizeof(d[1]),cmp); //for(i=1;i<=nteam;i++) //printf("%d %d %d\n",d[i].num,d[i].n,d[i].time); for(i=1;i<nteam;i++) printf("%d ",d[i].num); printf("%d\n",d[nteam].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