Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

Taniaaleksandrova avatar Taniaaleksandrova 6 Точки

02. Judge - More Exercise -Associative Arrays- Fundamental C#

Здравейте,

става въпрос за задача 02. Judge - More Exercise, гърмят ми всички тестове без 6 и не мога да разбера къде е проблема, какъвто и вход да въведа работи правилно, но в judge ми дава 8/100. Ще съм много благодарна, ако някой ми помогне

Ето кода ми - https://pastebin.com/5BpXaPVm

Условие

You know the jude system, right?! Your job is to create a program similar to the Judge system.

You will receive several input lines in one of the following formats:

{username} -> {contest} -> {points}

The constestName and username are strings, the given points will be an integer number. You need to keep track of every contest and individual statistics of every user. You should check if such contest already exists, and if not, add it, otherwise check if the current user Is participating in the contest, if he is participating take the higher score, otherwise just add it.

Also you need to keep individual statistics for each user - the total points of all constests.

You should end your program when you receive the command "no more time". At that point you should print each contest in order of input, for each contest print the participants ordered by points in desecending order, than ordered by name in ascending order.  After that, you should print individual statistics for every participant ordered by total points in desecnding order, and then by alphabetical order.

Input / Constraints

  • The input comes in the form of commands in one of the formats specified above.
  • Username and contest name always will be one word.
  • Points will be an integer will be an integer in range [0, 1000].
  • There will be no invalid input lines.
  • If all sorting criteria fail, the order should be by order of input.
  • The input ends when you receive the command "no more time".

Output

  • The output format for the contests is:

{constestName}: {participants.Count} participants

{position}. {username} <::> {points}

  • After you print all contests, print the individual statistics for every participant.
  • The output format is:

Individual standings:

{position}. {username} -> {totalPoints}

Examples

Input

Output

Pesho -> Algo -> 400

Gosho -> Algo -> 300

Stamat -> Algo -> 200

Pesho -> DS -> 150

Mimi -> DS -> 600

no more time

Algo: 3 participants

1. Pesho <::> 400

2. Gosho <::> 300

3. Stamat <::> 200

DS: 2 participants

1. Mimi <::> 600

2. Pesho <::> 150

Individual standings:

1. Mimi -> 600

2. Pesho -> 550

3. Gosho -> 300

4. Stamat -> 200

Pesho -> OOP -> 350

Gosho -> OOP -> 250

Stamat -> Advanced -> 600

Gosho -> OOP -> 300

Prakash -> OOP -> 300

Prakash -> Advanced -> 250

Ani -> JSCore -> 400

no more time

OOP: 3 participants

1. Pesho <::> 350

2. Gosho <::> 300

3. Prakash <::> 300

Advanced: 2 participants

1. Stamat <::> 600

2. Prakash <::> 250

JSCore: 1 participants

1. Ani <::> 400

Individual standings:

1. Stamat -> 600

2. Prakash -> 550

3. Ani -> 400

4. Pesho -> 350

5. Gosho -> 300

Тагове:
0
Fundamentals Module
nickwork avatar nickwork 657 Точки

Всичко е ок , леко съм оправил сортировката а другото е 6... копирай на право това парче код на мястото на твоят..или добави промените сама.

това не ти трябва  contests = contests.OrderByDescending(x => x.Value.Count).ThenBy(x => x.Key).ToDictionary(a => a.Key, b => b.Value); 

 int position = 1;

            foreach (var item in contests) //contest in order of input!!!
            {
                position = 1;
                Console.WriteLine($"{item.Key}: {item.Value.Count} participants");

                foreach (var items in item.Value.OrderByDescending(x => x.Value).ThenBy(x => x.Key)) //thеn ordered by name in ascending order
                {
                    Console.WriteLine($"{position}. {items.Key} <::> {items.Value}");
                    position++;
                }
            }

0
Taniaaleksandrova avatar Taniaaleksandrova 6 Точки

Много благодаря!

Така става като не се чете условието хубавоlaugh

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