RankingTime
limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 16134 Accepted Submission (s): 5836
Problem description today's on-machine exam Although there is real-time ranklist, but the above ranking is only based on the number of completed questions sorted, not considered
The score of each question, so not the final ranking. Given the admission fraction, please write the procedure to find the last pass
Candidates, and will print their scores in descending order.
The input test entry contains information about several exam fields. 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; 2nd row sort gives the positive integer score of question 1th to M; The following n lines, each one
A candidate's ticket number (a string of not more than 20), the total number of questions solved by the student, and the question number of the M-question.
(the title number is 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 the number of candidates in line 1th is not lower than the score of N, and then n rows by scores from high
The test number and score of the candidate on the low output line are separated by 1 spaces. If multiple candidates have the same score, they will be tested according to their
The ascending output of the 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 000001 0cs000000000000000002 2 1 20
Sample Output
3cs003 60cs001 37cs004 3701cs000000000000000002HintHuge input, scanf is recommended.
SOURCE Zhejiang University Computer Postgraduate exam on the machine-2005
Really drunk, Runtime error one night ... Finally, the structure is stored from subscript 1, ac ... #include <stdio.h> #include <string.h> #include <algorithm>using namespace std;struct St{char xuehao[ 22];int Fen;} Data[1010];int CMP (St A,st b) {if (A.fen!=b.fen) return A.fen>b.fen;else if (strcmp (A.xuehao,b.xuehao) <0) return 1;else return 0;} int main () {int I,n,m,l,x,k,sum,ans;int c[20];while (scanf ("%d", &n) &&n) {scanf ("%d%d", &m,&l); Memset (C,0,sizeof (c)); for (i=1;i<=m;i++) { scanf ("%d", &c[i]);} for (i=1,ans=0;i<=n;i++) {sum=0;scanf ('%s%d ', data[i].xuehao,&k), while (k--) {scanf ("%d", &x); sum+=c[x];} Data[i].fen=sum;if (data[i].fen>=l) ans++;} Sort (data+1,data+n+1,cmp);p rintf ("%d\n", ans); for (i=1;i<=ans;i++) printf ("%s%d\n", Data[i].xuehao,data[i] . Fen);} return 0;}
Ranking (Hangzhou electric oj1236) (Simple sort)