| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12229 | GEC1506 Top 3 |
|
| 12772 | GEC1506 Scoreboard parsing (Advance) |
|
Description
Given a few lines of text, you need to parse it and perform the following requirements.
Hint: Please use sys.stdin instead of input() in this homework as there are multiple lines, else you will not be accepted!!!
Input
In this assignment, a few lines of text will be given as an input.
The format for each line of the text are
char,num
Hint: Not all num is Integer !!!!!!
Output
You will need to read the given input and sum the total number of each character.
You don't need to take care the numbers of the decimal for the result number.
Then, print out only the top 3 as your output results.
Note that the input and output below is just a sample test case.
Please DO NOT directly use it as your input.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Calculate the score of students from the NTHU OJ scoreboard based on the passed test cases in the question.
Multiple lines of score information, where each line is an answering record for a user account.
Input
The number of questions for a contest could have more than one.
The format of each line after line 1 is given as:
Rank, User, problem1_passed_case,problem1_total_cases, problem2_passed_cases,problem2_total_cases2, ... , problemN_passed_cases,problemN_total_cases, Total Cases
Examples :
1,GEC2_105071035,3,3,2,5, ...,0,1,12
The 3,3 denotes passed_cases,total_cases of problem1.
The 2,5 denotes passed_cases,total_cases of problem2, and so on.
The score of a question is calculated as the number of passed test cases divided the number of test cases within a question.
For example, the score of problem1 is 100. And the score of problem2 is 40 (=2/5*100).
The score of a student is calculated as the average of all questions.
Output
The score for each student of the given contest with the format:
User,Score
Note that
- The order of the output score should follow the same order of the input.
- The score should have 2 decimals.