Topic Description: today's on-machine test is RANKL ist, but the top ranking is based on the completion of the number of titles, not considering the score of each question, so not the final ranking. Given the admission score, please write the program to find the final pass of the test takers, and their results in descending order to print. Input: Test input contains a number of exam information. The 1th line of each exam information gives the number of candidates N (0 < n < 1000), number of questions m (0 < M < = 10), bar (positive integer) G; the 2nd row gives the positive integer value of the 1th to question m; The following N rows, each row gives a candidate's ticket number (length not A string of more than 20, the total number of questions that the student resolved m, and the question number of this m problem (subject number 1 to m). When the number of candidates enrolled is 0 o'clock, the entry ends and the test is not processed. Output: for each test, first on line 1th output no less than the fraction Number of candidates N, followed by the score from high to low output on the line test number and score, with 1 spaces separated. If a number of candidates have the same score, they will be output in ascending order. Sample input: 4 5 CS004 3 5 1 3 CS003 5 2 4 1 3 5 CS002 2 1 2 CS001 3 2 3 5 1 2 CS001 1 2 2 3 m CS000000000000000001 0 CS00000000000 0000002 2 1 2 0 example output: &NBSP 3 CS003 CS001 CS004 Notoginseng 0 1 CS000000000000000002 &nb Sp
#include <iostream> #include <string> #include <vector> #include <algorithm> #include
;cstring> using namespace std;
typedef struct Persons {string id;
int total;
int grade;
}persons;
BOOL Compare (persons A,persons B) {if (A.grade!=b.grade) return a.grade>b.grade;
else return a.id < b.id;
int main () {int n,m,g;
Vector<persons> VEC;
int grade[11];
while (cin>>n,n!=0) {memset (grade,0,sizeof (grade));
Vec.clear ();
int ans=0;
cin>>m>>g;
for (int i=1;i<=m;i++) cin>>grade[i];
for (int i=0;i<n;i++) {persons p;
cin>>p.id>>p.total;
P.grade = 0; for (int j=1;j<=p.total;j++) {int t;
cin>>t;
P.grade + = grade[t];
} if (P.grade >= G) ++ans;
Vec.push_back (P);
Sort (Vec.begin (), vec.end (), compare);
cout<<ans<<endl;
for (int i=0;i<ans;++i) {cout<<vec[i].id<< "" <<vec[i].grade<<endl;
}//system ("pause");
return 0; }