Computers and Technology
Computers and Technology, 10.05.2021 18:50, rome58

Witches Three witches are brewing potions around their cauldron when they notice that someone has mixed up all n of their carefully crafted potions. Each potion is a carefully-measured mixture of exact ratios of m distinct individual components (e. g. eye of newt, etc.). Mixed together, even though the components are the same, the ratios of the potions are now all wrong and will not have the desired effect.
Luckily, the vials in which the potions are kept are bottomless. In theory, the witches have an unbounded amount of each of the messed-up potions.
There is one potion in particular that the witches are interested in making so they need to combine the potions that they have into their cauldrons so as to come up with the correct ratio for it.
Consider the following example where n = 2 and m = 3: Two potions are available with the ratios of 1:2:3 and 3:7:1, respectively. By mixing those two solutions together in the ratio 1:2, it is possible to obtain a solution of the m = 3 components with ratio 7:16:5, but there is no way to combine these two potions together into a new one with ratio 3:4:5. However, if the witches find another potion with ratio 2:1:2 (making the problem into one where n = 3), then a 3:4:5 mixture is possible with eight parts of 1:2:3, one part 3:7:1, and 5 parts of 2:1:2.
So clearly, determining which mixtures can be obtained from a given set of potions is not trivial. It is your goal in this assignment to do so.
Input/Output
The top line of the input file (input. txt) will be a line with a desired ratio in the form a1 : a2 : a3 : ... : am. The next n lines will be the base solution ratios.
Your output file (output. txt) will consists of n lines, each containing a single integer. These will indicate the parts necessary to get the desired ratio. If no combination is possible, then return the value −1 on each line.
1
So, for example above, the input file (input. txt) would look as follows:
3:4:5
1:2:3
3:7:1
2:1:2
and the output file (output. txt) would look as follows:
8
1
5
the program can be written in either python, c++ or java

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 04:00, coolconnor1234p0sv4p
Another name for addicting games. com
Answers: 1
image
Computers and Technology, 23.06.2019 09:10, djs1671
(328 inc. 448 ind. 480 in25. john has a collection of toy cars. he has 2 red cars, 4 blue cars, 4 black cars, and 6 yellowcars. what is the ratio of red cars to yellow cars? a. 1: 2b. 1: 3c. 1: 626. the net of a right triangular prism is shown below.
Answers: 2
image
Computers and Technology, 23.06.2019 21:50, Trinhphuongtran
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
image
Computers and Technology, 24.06.2019 13:20, ana9340
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
Do you know the correct answer?
Witches Three witches are brewing potions around their cauldron when they notice that someone has...

Questions in other subjects: