This is mainly a comparison of the sort, but still have to pay attention to a few points, the first is the time and then the top of the processing
http://blog.csdn.net/a809146548/article/details/46352093
#include <cstdio> #include <algorithm> #include <cstring>using namespace std;struct node{int score; int num; Char time[10]; } stu[101];bool CMP (const node& A,const node& b) {if (A.num==b.num) return strcmp (a.time,b.time) <0; else return a.num>b.num;} int S[6][2]={50,50,60,65,70,75,80,85,90,95,100,100};int Main () {int n,i,x[6],j; Char index[101][10]; while (scanf ("%d", &n) &&n>0) {for (i=1;i<=n;i++) {scanf ("%d%s", &STU[I].N Um,stu[i].time); strcpy (Index[i],stu[i].time); } sort (stu+1,stu+n+1,cmp); memset (x,0,sizeof (x)); for (i=1;i<=n;i++) x[stu[i].num]++; for (i=1;i<=4;i++) if (x[i]!=1) x[i]/=2; for (i=1;i<=n;i++) if (x[stu[i].num]>0) {stu[i].score=s[stu[i].num][1]; X[stu[i].num]--; } else stu[i].score=s[stu[i].num][0]; for (i=1;i<=n;i++) for (j=1;j<=n;j++) if (strcmp (index[i],stu[j].time) ==0) { printf ("%d\n", Stu[j].score); Break } putchar (' \ n '); } return 0;}
E-what is Grades?