Loading...

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

EmilVelichkov avatar EmilVelichkov 1 Точки

Plant Discovery

Здравейте, колеги  37/100 на тази задача...Аутпутите ми са вярни, но ми гърмят 5 теста с Runtime error.

Помогнете, моля!

https://pastebin.com/FJ1UeHrL

Problem 3. Plant Discovery

You have now returned from your world tour. On your way you have discovered some new plants and you want to gather some information about them and create an exhibition to see which plant is highest rated.

On the first line you will receive a number n. On the next n lines, you will be given some information about the plants that you have discovered in the format: "{plant}<->{rarity}". Store that information, because you will need it later. If you receive a plant more than once, update its rarity.

After that until you receive the command "Exhibition" you will be given some of these commands:

  • Rate: {plant} - {rating}add the given rating to the plant (store all ratings)
  • Update: {plant} - {new_rarity}update the rarity of the plant with the new one
  • Reset: {plant}remove all the ratings of the given plant

Note: If any of the command is invalid, print "error"

After the command "Exhibition" print the information that you have about the plants in the following format:

Plants for the exhibition:
- {plant_name}; Rarity: {rarity}; Rating: {average_rating formatted to the 2nd digit}

The plants should be sorted by rarity descending, then by average rating descending

Input / Constraints

  • You will recive the input as described above
  • JavaScript: you will receive a list of strings

Output

  • Print the information about all plants as described above

Examples

Input

Output

3

Arnoldii<->4

Woodii<->7

Welwitschia<->2

Rate: Woodii - 10

Rate: Welwitschia - 7

Rate: Arnoldii - 3

Rate: Woodii - 5

Update: Woodii - 5

Reset: Arnoldii

Exhibition

Plants for the exhibition:

- Woodii; Rarity: 5; Rating: 7.50

- Arnoldii; Rarity: 4; Rating: 0.00

- Welwitschia; Rarity: 2; Rating: 7.00

2

Candelabra<->10

Oahu<->10

Rate: Oahu - 7

Rate: Candelabra - 6

Exhibition

Plants for the exhibition:

- Oahu; Rarity: 10; Rating: 7.00

- Candelabra; Rarity: 10; Rating: 6.00

Тагове:
1
Programming Fundamentals
krum_43 avatar krum_43 750 Точки

Здравей колега,

Не мога да ти кажа къде ти се чупи кода,но имам едно решение на задачата(100/100),което може да разгледаш ако желаеш:

https://pastebin.com/ZbxcKp9U 

 

0
EmilVelichkov avatar EmilVelichkov 1 Точки

Благодаря, колега!

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