Loading...

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

PoliDobreva avatar PoliDobreva 1 Точки

Problem 2. SoftUni Karaoke c#

Някой може ли да даде едно рамо с моя код. He мога да взема повече от 60/100...

Ето решението: https://pastebin.com/HWCY4BTA

Eто и задачата:

SoftUni cultivates talent whether it's coding talent or something else and in this case, something else is singing. Since you love music you want to take part in the event but as a programmer you simply lack the "something else" so your job is to make the software to track participants' awards.

On the first line, you will receive a list with all participants that applied for performance.

On the second line, you will receive the list with all available songs.

On the next lines, until the "dawn" command, you will get the names of people, the song that they are performing on stage and the award they get from the audience.

However, not every time the plan goes according to schedule. In other words, everyone (listed or not) can go on stage and perform a song that is not even available and he still gets awards from the audience. However, you should record only the awards for listed participants that perform songs available in the list. In case someone is not listed or sings a song that is not available you should not record neither the participant, nor his award

When the "dawn" comes, you need to print all participants, the count of the unique awards they received and all unique awards. Participants should be sorted by number of awards in descending order and then by participant name alphabetically. Awards should be sorted in alphabetical order.

Input

  • On the first line, you will receive list with all participants that applied for performance in the format: "{participant}, {participant} … {participant}"
  • On the second line, you will get all available songs in the in the format: "{song}, {song} … {song}"
  • On the next lines, until the "dawn" command you will receive every stage performance in the format: "{participant}, {song}, {award}"
  • Performances and songs will be separated by a comma and a single or multiple white spaces

Output

  • Print all participants along with the number of unique awards they won in the format:
    • "{participant}: {award count} awards"
    • "--{award}"
  • Print participants sorted by unique awards count in descending order. If two participants have the same unique award count, sort them alphabetically by name
  • Print unique awards for every participant sorted alphabetically
  • If there are no awards, print "No awards"

Constrains

  • The number of total participants will be in range [1 … 100]
  • The number of total songs will be in range [1 … 100]
  • The input will always end with the "dawn" command

 

 

Examples

Input

Output

Trifon, Vankata, Gesha

Dragana - Kukavice, Bon Jovi - It's my life, Lorde - Royals

Gesha, Bon Jovi - It's my life, Best Rock

Vankata, Dragana - Kukavice, Best Srabsko

Vankata, Dragana - Kukavice, Best Srabsko

Vankata, Dragana - Kukavice, Stiga Tolko Srabsko

Vankata, PHP Web, Educational 101

dawn

Vankata: 2 awards

--Best Srabsko

--Stiga Tolko Srabsko

Gesha: 1 awards

--Best Rock

Gesha

Bon Jovi - It's my life

Gesha, Bon Jovi - It's my life, Best Rock

Vankata, Dragana - Kukavice, Best Srabsko

Vankata, Dragana - Kukavice, Stiga Tolko Srabsko

Vankata, PHP Web, Educational 101

dawn

Gesha: 1 awards

--Best Rock

Sino

Vasko Naidenov - Nova Godina

dawn

No awards

 

 

Тагове:
0
Programming Basics
TeodorStefanovPld avatar TeodorStefanovPld 1274 Точки

Awards should be sorted in alphabetical order. - това не го правиш никъде сортираш само  участниците по брой награди и име на участника,но никъде не сортираш самите награди по име.

И тоя код може се изчисти с малко боол проверки и тн,а и класа които си направила е е малко безмислен.По логично би било да направиш един списък от участници,с всички пропертита и там да държиш списъка с наградите,и накрая просто малко Linq и боол проверки,и речника щеше да е излишен а само с един лист да работиш.

 foreach (var award in winner.Awards.OrderBy(x=>x)) нещо такова примерно.

0
15/11/2018 14:48:28
VasilKos avatar VasilKos 17 Точки

За JAVA колегите, може ли помощ за принта накрая. Не мога да сортирам правилно:

SoftUni Karaoke - Pastebin.com  това е кодът:

Успях да намеря подобен принт.: Ако на някой му потрябва: 

singers.entrySet().stream().sorted((e1, e2) -> Integer.compare(e2.getValue().size(), e1.getValue().size()))
        .forEach(entry -> {
            System.out.printf("%s: %d awards%n", entry.getKey(), entry.getValue().size());
            entry.getValue().stream().sorted(String::compareTo).forEach(element -> System.out.printf("-- %s%n", element));
            //entry.getValue().forEach(element -> System.out.printf("-- %s%n", element));
        });
0
01/02/2022 21:02:56
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.