Manage the Robot Factory: Day 1
Description:
Explanation
It's your first day in the robot factory and your supervisor thinks that you should start with an easy task. So you are responsible for purchasing raw materials needed to produce the robots.
A complete robot weights 50
kilogram. Iron is the only material needed to create a robot. All iron is inserted in the first machine; the output of this machine is the input for the next one, and so on. The whole process is sequential. Unfortunately not all machines are first class, so a given percentage of their inputs are destroyed during processing.
Task
You need to figure out how many kilograms of iron you need to buy to build the requested number of robots.
Example
Three machines are used to create a robot. Each of them produces 10%
scrap. Your target is to deliver 90
robots.
The method will be called with the following parameters:
CalculateScrap(scrapOfTheUsedMachines, numberOfRobotsToProduce)
CalculateScrap(int[] { 10, 10, 10 }, 90)
Assumptions
- The scrap is less than
100%
. - The scrap is never negative.
- There is at least one machine in the manufacturing line.
- Except for scrap there is no material lost during manufacturing.
- The number of produced robots is always a positive number.
- You can only buy full kilograms of iron.
Similar Kata:
Stats:
Created | Feb 6, 2017 |
Published | Feb 8, 2017 |
Warriors Trained | 1084 |
Total Skips | 34 |
Total Code Submissions | 3164 |
Total Times Completed | 432 |
C# Completions | 86 |
JavaScript Completions | 130 |
CoffeeScript Completions | 8 |
PHP Completions | 54 |
Python Completions | 191 |
Total Stars | 19 |
% of votes with a positive feedback rating | 87% of 114 |
Total "Very Satisfied" Votes | 88 |
Total "Somewhat Satisfied" Votes | 22 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |