Loading...

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

arnold avatar arnold 50 Точки

Legendary Farming (Associative Arrays)

Малко помощ, не мога да открия защо ми дава 80/100

 

https://pastebin.com/X0px9NxF

 

https://judge.softuni.bg/Contests/Compete/Index/1213#2

 

Legendary Farming

You’ve done all the work and the last thing left to accomplish is to own a legendary item. However, it's a tedious process and it requires quite a bit of farming. Anyway, you are not too pretentious - any legendary item will do. The possible items are:

  • Shadowmourne - requires 250 Shards;
  • Valanyr - requires 250 Fragments;
  • Dragonwrath - requires 250 Motes;

Shards, Fragments and Motes are the key materials and everything else is junk. You will be given lines of input, in the format: "2 motes 3 ores 15 stones"

Keep track of the key materials - the first one that reaches the 250 mark, wins the race. At that point you have to print that the corresponding legendary item is obtained. Then, print the remaining shards, fragments, motes, ordered by quantity in descending order, then by name in ascending order, each on a new line. Finally, print the collected junk items in alphabetical order.

Input

  • Each line comes in the following format: "{quantity} {material} {quantity} {material} … {quantity} {material}"

Output

  • On the first line, print the obtained item in the format: "{Legendary item} obtained!"
  • On the next three lines, print the remaining key materials in descending order by quantity
    • If two key materials have the same quantity, print them in alphabetical order
  • On the final several lines, print the junk items in alphabetical order
    • All materials are printed in format "{material}: {quantity}"
    • The output should be lowercase, except for the first letter of the legendary

Examples

Input

Output

3 Motes 5 stones 5 Shards

6 leathers 255 fragments 7 Shards

Valanyr obtained!

fragments: 5

shards: 5

motes: 3

leathers: 6

stones: 5

123 silver 6 shards 8 shards 5 motes

9 fangs 75 motes 103 MOTES 8 Shards

86 Motes 7 stones 19 silver

Dragonwrath obtained!

shards: 22

motes: 19

fragments: 0

fangs: 9

silver: 123

Тагове:
0
Fundamentals Module 18/07/2021 23:03:24
icowwww avatar icowwww 2673 Точки
Best Answer

Здравей,

Проверката от ред 41 е невалидна, защото проверява всички елементи дали имат 250 или повече, без значение дали са key materials

Ето с променена проверката на:

if (dictionary["shards"] >= 250 || dictionary["fragments"] >= 250 || dictionary["motes"] >= 250)

https://pastebin.com/hCW1kcZy

0
18/07/2021 23:14:41
arnold avatar arnold 50 Точки

Супер си, благодаря много! 

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