#include<stdio.h>#include<algorithm>Usingnamespace Std;struct student{Char id[15];int Score,final_rank,location_number,local_rank;Score, total rank, examination room number, ranking}stu[30010];BOOL CMP (Student A, Student b) {if (A.score!=b.score)Return a.score>b.score;By score from big to smallElseReturn strcmp (A.id,b.id) <0;By dictionary order from small to large}int main () {int n,i=0;I record the number of all Stu students scanf ("%d", &n);Forint t=1; T<=n; ++T)N Examination Room {int k; scanf"%d", &k);Forint i=0; i<k; ++i) {scanf ("%s%d", &stu[i+i].id, &stu[i+i].score);Record ID, score stu[i+i].location_number=t;Record exam Number} sort (stu+i,stu+i+k,cmp); stu[i].local_rank=1;Forint i=1; i<k; ++i)Record in-field rankings {if (stu[i+i].score==stu[i+i-1].score) stu[i+i].local_rank=stu[i+i-1].local_rank;Same rank as the previous studentelse stu[i+i].local_rank=i+1;Otherwise ranked as i+1} i+=k;To the next exam, I start with the K-test taker after the sort (stu,stu+i,cmp); stu[0].final_rank=1;Forint i=1; I<i; ++i)//total rank {if (stu[i].score==stu[i-1].score) stu[i] . Final_rank=stu[i-1].final_rank; //and former classmates ranked the same else stu[i].final_rank=i+1; //otherwise ranked i+1} printf ( "%d\n ", I); for (int i=0; i<i; ++i) printf ( "%s%d%d%d\n return 0;}
pat:1025. PAT Ranking (25) Edit error