Title Description: Today's on-machine examination Although there is real-time ranklist, but the above 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 fraction, please write the program to find the final pass test takers and print their scores in descending order. Input: The test input contains information for several exams. The 1th line of each exam information gives the number of candidates N (0 < N < 1000), the number of questions M (0 < M < = 10), the bar (positive integer) G, and the 2nd row gives the positive integer score for the 1th to the M question; The following N lines, each line gives a candidate's ticket number (length does not More than 20 strings), the total number of topics solved by the student m, and the question number of the M-Question (subject number from 1 to m). When the number of candidates read is 0 o'clock, the input is completed and the exam is not processed. Output: For each exam, first in the 1th line output no less than the number of candidates N, and then n line by the score from high to low output test number and scores of candidates, between 1 spaces separated. If multiple candidates have the same score, they will be output in ascending order of their test number. Sample input: 4 5 2510 15cs004 3 5 1 3cs003 5 2 4 1 3 5cs002 2 1 2cs001 3 2 3 Wuyi 2 4010 30cs001 1 3 000000000001 0cs000000000000000002 2 1 20 sample output: 3cs003 60cs001 37cs004 3701cs000000000000000002 20
#include
#include
#include
#include #include
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
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
>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<
http://www.bkjia.com/phpjc/532695.html www.bkjia.com True http://www.bkjia.com/phpjc/532695.html techarticle topic Description: Today's on-machine exam Although there is a real-time ranklist, but the above ranking is based on the completion of the number of questions sorted, not considering the score of each question, so not the final ranking. ...