Loading...

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

Breyanova91 avatar Breyanova91 9 Точки

JS Fundamentals Functions - More Exercise Radio Crystals

Здравейте, след 3 часа умуване вече доста се омотах  - дава ми 66 /100. Не разбирам къде греша. Благодаря предварително, ако някой помогне.

https://pastebin.com/7mF6jPVU

 

 

 

Radio Crystals

You need to write a JS program that monitors the current thickness of the crystal and recommends the next procedure that will bring it closer to the desired frequency. To reduce waste and the time it takes to make each crystal your program needs to complete the process with the least number of operations. Each operation takes the same amount of time, but since they are done at different parts of the factory, the crystals have to be transported and thoroughly washed every time an operation different from the previous must be performed, so this must also be taken into account. When determining the order, always attempt to start from the operation that removes the largest amount of material.

The different operations you can perform are the following:

  • – cuts the crystal in 4
  • – removes 20% of the crystal’s thickness
  • – removes 20 microns of thickness
  • – removes 2 microns of thickness
  • – increases the thickness of the crystal by 1 micron; this operation can only be done once!
  • Transporting and washing – removes any imperfections smaller than 1 micron (round down the number); do this after every batch of operations that remove material

At the beginning of your program, you will receive a number representing the desired final thickness and a series of numbers, representing the thickness of crystal ore in microns. Process each chunk and print to the console the order of operations and number of times they need to be repeated to bring them to the desired thickness.

The input comes as a numeric array with a variable number of elements. The first number is the target thickness and all following numbers are the thickness of different chunks of quartz ore.

The output is the order of operation and how many times they are repeated, every operation on a new line. See the examples for more information.

Examples

Input

Output

[1375, 50000]

Processing chunk 50000 microns

Cut x2

Transporting and washing

Lap x3

Transporting and washing

Grind x11

Transporting and washing

Etch x3

Transporting and washing

X-ray x1

Finished crystal 1375 microns

 

1
JavaScript Fundamentals
Breyanova91 avatar Breyanova91 9 Точки

супер.много благодаря ... аз го разбрах,че във функцията само веднъж мога да ползвам X-ray за всички числа и че втпри път не може да се ползва :) голяма мъка thanks :)

1
willystyle avatar willystyle 2472 Точки

като цяло просто не са написали условието както трябва, искали са да кажат, че не бива да шлайфаш повече от -1 мм, иначе не може да възстановиш, освен това има 1-2 други логически грешки в условието, например: When determining the order, always attempt to start from the operation that removes the largest amount of material. Тук няма такива тестове да чупят това условие, но да не задълбаваме :)

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