Loading...
Vesolini avatar Vesolini 7 Точки

02. Seize the Fire - Technology Fundamentals Mid Exam - 10 March 2019 Group 2

Здравейте,

Имате ли решение на задачата Seize the Fire от Mid Exam - 10 March 2019 Group 2  https://judge.softuni.bg/Contests/Practice/DownloadResource/5375? 

Judje ми дава 70/100 и търся решение, което да е коректно за да си открия грешките.

Благодаря!

П.С. Ако не ви се отваря линка, копирм цялото условие --->

Seize the Fire

The group of adventurists have gone on their first task. Now they have to walk through fire - literally. They have to use all of the water they have left. Your task is to help them survive.

Create a program that calculates the water that is needed to put out a "fire cell", based on the given information about its "fire level" and how much it gets affected by water.

First, you will be given the level of fire inside the cell with the integer value of the cell, which represents the needed water to put out the fire.  They will be given in the following format:

"{typeOfFire} = {valueOfCell}#{typeOfFire} = {valueOfCell}#{typeOfFire} = {valueOfCell}……"

Afterwards you will receive the amount of water you have for putting out the fires. There is a range of fire for each of the fire types, and if a cell’s value is below or exceeds it, it is invalid and you don’t need to put it out.

Type of Fire

Range

High

81 - 125

Medium

51 - 80

Low

1 - 50

If a cell is valid, you have to put it out by reducing the water with its value. Putting out fire also takes effort and you need to calculate it. Its value is equal to 25% of the cell’s value. In the end you will have to print the total effort. Keep putting out cells until you run out of water. If you don’t have enough water to put out a given cell – skip it and try the next one. In the end, print the cells you have put out in the following format:

"Cells:

 - {cell1}

 - {cell2}

 - {cell3}

……

 - {cellN}"

"Effort: {effort}"

In the end, print the total fire you have put out from all of the cells in the following format: "Total Fire: {totalFire}"

Input / Constraints

  • On the 1st line you are going to receive the fires with their cells in the format described above – integer numbers in the range [1…500]
  • On the 2nd line, you are going to be given the wateran integer number in the range [0….100000]

Output

  • Print the cells, which you have put out in the following format:

"Cells:

 - {cell}

 - {cell2}

 - {cell3}

 - {cell5}

……

 - {cellN}"

  • Print the effort, rounded 2 digits after the decimal separator in the following format:

"Effort: {effort}"

  • Print the total fire put out

"Total Fire: {totalFire}"

Examples

Input

Output

High = 89#Meduim = 53#Low = 28#Medium = 77#Low = 23

1250

Cells:

 - 89

 - 28

 - 77

 - 23

Effort: 54.25

Total Fire: 217

Comments

After reading the output, we start checking the level of the fire and its validity. The first is valid, so we subtract the 89 from the amount of water – 1250, and the water becomes 1161. We need to calculate the effort, which is 25% of 89. We will add 89 to the total fire we have put out. In the end the effort is 54.22 and the total fire: 217

Input

Output

High = 150#Low = 55#Medium = 86#Low = 40#High = 110#Medium = 77

220

Cells:

 - 40

 - 110

Effort: 37.50

Total Fire: 150

 

 

Тагове:
0
Programming Fundamentals
RyderMcCathie avatar RyderMcCathie 1 Точки

Software university has a website that includes live sessions and other programs online. Also you can get best essay writing service reviews to manage your quality task easily. It has forums and RRS information that knows great dealing of programs with online culture. You can also get forums from it. Join them for more updates.

0
JoEmily avatar JoEmily 2 Точки

You may stumble, may fail, may be discouraged, but never give up. Fun games for young children games for girls
 

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