Loading...
maria_banova avatar maria_banova 1 Точки

09. SoftUni Exam Results C#

Здравейте! Бихте ли ми обяснили защо при първия foreach не ми сортира нищо? 

Условие: 

Problem 9. *SoftUni Exam Results

Judge statistics on the last Programing Fundamentals exam was not working correctly, so you have the task to take all the submissions and analyze them properly. You should collect all the submissions and print the final results and statistics about each language that the participants submitted their solutions in.

You will be receiving lines in the following format: "{username}-{language}-{points}" until you receive "exam finished". You should store each username and his submissions and points.
You can receive a command to ban a user for cheating in the following format: "{username}-banned". In that case, you should remove the user from the contest, but preserve his submissions in the total count of submissions for each language.

After receiving "exam finished" print each of the participants, ordered descending by their max points, then by username, in the following format:

"Results:"

"{username} | {points}"

After that print each language, used in the exam, ordered descending by total submission count and then by language name, in the following format:

"Submissions:"

"{language} – {submissionsCount}"

Input / Constraints

Until you receive "exam finished" you will be receiving participant submissions in the following format: "{username}-{language}-{points}".

You can receive a ban command -> "{username}-banned"

The points of the participant will always be a valid integer in the range [0-100];

Output

  • Print the exam results for each participant, ordered descending by max points and then by username, in the following format:

"Results:"

"{username} | {points}"

  • After that print each language, ordered descending by total submissions and then by language name, in the following format:

"Submissions:"

"{language} – {submissionsCount}"

  • Allowed working time / memory: 100ms / 16MB.

Examples

Input

Output

Comment

Peter-Java-84

George-C#-70

George-C#-84

Sam-C#-94

exam finished

Results:

Sam | 94

George | 84

Peter | 84

Submissions:

C# - 3

Java - 1

We order the participant descending by max points and then by name, printing only the username and the max points.

After that, we print each language along with the count of submissions, ordered descending by submissions count, and then by language name.

Peter-Java-91

George-C#-84

Sam-JavaScript-90

Sam-C#-50

Sam-banned

exam finished

 

Results:

Peter | 91

George | 84

Submissions:

C# - 2

Java - 1

JavaScript - 1

Sam is banned so he is removed from the contest, but his submissions are still preserved in the languages submissions count.

So although there are only 2 participants in the results, there are 4 submissions in total.

 

Линк към кода: https://pastebin.com/KqfwJX7k

Тагове:
0
C# Advanced
adamusa avatar adamusa 2 Точки

I appreciate the method you give. I have learned a lot from you. aa route planner

-1
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.