HDU 2093 Exam Rankings

Source: Internet
Author: User

Exam Rankings Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 9543 Accepted Submission (s): 3327


The real-time submission system for problem descriptionc++ programming exams features instant performance rankings. How is its function implemented?
We have done the answer to the question, after the submission, either "AC", or wrong, regardless of the wrong method, always put a note to you, indicating that you have a mistake to submit, so once you submit the topic "AC", you will be counted, the total number of errors submitted several back. Although you are striding up a step in the number of questions, you have to spend time on it. In particular, there have been errors submitted, each time must be amortized on a certain unit time points. In this way, you may be a lot more likely to lead others in the number of questions you make, but you may be at a disadvantage in the time-consuming rankings of people who do the same number of questions.
For example: A total of 8 questions (A,B,C,D,E,F,G,H), each of the questions are in the corresponding title number under the number of marks, negative numbers indicate that the student has been wrong to submit the number of times, but until now there is no AC, positive indicates the time spent on AC, if positive A followed by a pair of parentheses, There is an integer b, that means the student submits the topic AC, consumes time a, and at the same time, has been wrongly submitted B, so for the following input data:



If the penalty for each error is divided into 20 points, then its ranking from high to low should be this:
Josephus 5 376
John 4 284
Alice 4 352
Smith 3 167
Bob 2 325
Bush 0 0

The first line of input data is the number of test questions N (1≤n≤12) and the unit penalty score m (10≤m≤20), each row of data that describes a student's user name (no more than 10 characters in a string) and the status of the answer to all n questions, which describes the format of the quantity tag in the problem description, See the table above, the number of submissions is always less than 100,ac time is always less than 1000.


Output will present the status of these students ' exams, outputting a real-time ranking. Real-time rankings are obviously first by the number of AC questions, many in front, and then by the time of the number of rows, less in front, if the coincidence before the two are equal, then by the name of the dictionary sequence, small in front. Each student occupies a row, the output name (10 characters justifies), the number of questions (2 characters justifies, right alignment) and time (4 characters justifies, right-aligned). There is a space between the name, the number of questions, and the time division.

Sample Input
8 20Smith  -1-16800120390john  116-211008255 (1) 0Josephus (  3) 12610-304721 (2) -2bush  0-1-800000alice  -267 (2) 13-1013379 (1) -1bob  0057 (5) 00168-70

Sample Output
Josephus    5  376John        4  284Alice       4  352Smith       3  167Bob         2  325Bush        0    0

Authorqianneng
Source greets new semester-super easy version

Ah ah ah, tortured me for three hours of the topic ... It's still a matter of detail.

On the Code bar ...

#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm>using namespace  Std;struct Node{int AC;  AC number int time; Time Char name[15];//name};node f[10000];bool CMP (node A,node b)//Sort {if (a.ac==b.ac) {if (a.time==b.time)//ac number and time are equal Retu RN strcmp (a.name,b.name) <0;//by dictionary name from small to large return a.time<b.time;//AC number equal time range, in ascending order of time. }return a.ac>b.ac;//ac number descending row.   }int Main () {int j,i,pp,n,m;scanf ("%d%d", &n,&m); i=0; Make i=0, represent the first person while (scanf ("%s", F[i].name)//Enter the name of the I person {f[i].ac=f[i].time=0;//order I personal AC number and time equals 0for (j=0;j<n; J + +)//n is the number of topics.  {scanf ("%d", &pp); Enter the number if (pp<=0)//If less than 0, the representative did not do it.   No matter the continue;f[i].ac++; Do it on behalf of 1A, the first I personal AC number plus one. f[i].time+=pp;//plus the time spent. if (getchar () = = ' (')//Enter a character equal to the parentheses from the keyboard, the question is made, but there is a miss. scanf ("%d", &pp),//input wrong number of times. f[i].time+=pp*m,//Plus penalty time, the penalty time is m* do wrong number of times. GetChar ();} i++;//plus an I, consider the next person's situation. }sort (F,F+I,CMP);//Do the above, sort for (j=0;j<i;j++) printf ("%-10s%2d%4d\n", f[j].name,f[j].ac,f[j].time);//output. return 0;}


HDU 2093 Exam Rankings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.