Професионална програма
Xadera avatar Xadera 5 Точки

9. * Legendary Farming

1.* Legendary Farming

You’ve beaten all the content and the last thing left to accomplish is own a legendary item. However, it’s a tedious process and requires quite a bit of farming. Anyway, you are not too pretentious – any legendary 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, all else is junk. You will be given lines of input, such as
2 motes 3 ores 15 stones. Keep track of the key materials - the first that reaches the 250 mark wins the race. At that point, print the corresponding legendary 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.


  • Each line of input is in format {quantity} {material} {quantity} {material} … {quantity} {material}


  • On the first line, print the obtained item in 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}
    • All output should be lowercase, except the first letter of the legendary


  • The quantity-material pairs are between 1 and 25 per line.
  • The number of lines is in range [1..10]
  • All materials are case-insensitive.
  • Allowed working time: 0.25s
  • Allowed memory: 16 MB

    Така, в judge-a ми гърмят половината проверки и не мога да разбера защо, ако някой може да ми помогне ще съм му благодарен! 
    Ето го и кодът ми: <ЦЪК!>
Programming Fundamentals
Xadera avatar Xadera 5 Точки

Видях си грешката. Не бях прочел този ред:
If two key materials have the same quantity, print them in alphabetical order


04/02/2017 14:24:03
damyan91 avatar damyan91 91 Точки

Здравейте, получавам 80/100 в Judge, но не мога да разбера защо. Ще съм благодарен, ако ударите едно рамо! :)

Ето го кодът ми: http://pastebin.com/WU96Xt45

04/02/2017 14:35:31