Reference no: EM13934441
A spellcaster is given an object (e.g. mouse, owl, dwarf, purse ...) and a set of spells that she / he can use to transform the object. The
effect of each spell is described by a set of from-to pairs. For example, spell "Chiroptera" may transform objects as follows:
crocodile -> dragon
mouse -> bat
If the spell is cast on an unspecified inital form, the form of the object is not changed.
The spellcaster possesses some finite amount of magical energy (an integer > 0). Each spell casting, whether fruitful or not, consumes
certain amount of magical energy (an integer > 0). Write a program that helps the spellcaster to transform the object into desired form in the most energy-efficient way.
The program inputs the description of spells, the amount of available magical energy, the initial object form, and the desired object form.
If desired transfiguration is possible, the program should print the appropriate sequence of spells to achieve the desired form. The sequence
of spells should consume the least possible amount of magical energy.
If the transformation is not possible the program should print:
TRANSFORMATION IS IMPOSSIBLE
Input data format:
------------------
The input data will be given in the following format:
number of spells (K)
name of spell 1 \
amount of energy consumed by spell 1 \
number of transformation pairs (N1) \
initial form 1 \
resultant form 1 \
initial form 2 information about spell 1
resultant form 2 /
... /
initial form N1 /
resultant form N1 /
name of spell 2 \
amount of energy consumed by spell 2 \
number of transformation pairs (N2) \
initial form 1 \
resultant form 1 \
initial form 2 information about spell 2
rtesultant form 2 /
... /
initial form N2 /
target form N2 /
...
...
...
name of spell k \
amount of energy consumed by spell k \
number of transformation pairs (Nk) \
initial form 1 \
resultant form 1 \
initial form 2 information about spell 2
rtesultant form 2 /
... /
initial form Nk /
target form Nk /
available amount of magical energy
initial form of the object
desired form of the object
You can assume that both the number of spells (K) and the number of
transformation pairs within a spell (N) are all less than 100, and that
amounts of magical energy are positive numbers < 1000000.
Example:
--------
Given below is an example input to the transfiguration program.
The input defines:
* two spells:
CHIROPTERA (each casting consumes 4 units of magical energy):
crocodile -> dragon
mouse -> bat
and REDUCTIO (each casting consumes 1 unit of magical energy):
elephant -> hyppo
hyppo -> horse
horse -> mouse
mouse -> elephant
* 8 units of available magical energy
* initial object "elephant"
* desired object form is "bat"
---- Input: ----
2
CHIROPTERA
4
2
crocodile
dragon
mouse
bat
REDUCTIO
1
4
elephant
hyppo
hyppo
horse
horse
mouse
mouse
elephant
8
elephant
bat
--------------------
In response to this input, your program should output:
REDUCTIO
REDUCTIO
REDUCTIO
CHIROPTERA
That output defines sequences of four transformations:
(Initial object: elephant; initial magical energy: 8 units)
Debt outstanding and total market value
: RAK, Inc., has no debt outstanding and a total market value of $240,000. Earnings before interest and taxes, EBIT, are projected to be $26,000 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 18 percen..
|
Discuss the effect this might have on the selection
: Some modern, capital-intensive production facilities have significantly reduced the proportion of direct labor cost to total production cost.
|
Analyse the obesity childhood in the uk
: Analyse the obesity childhood in the uk as a health problem, then analyse three effects of this problem on children and give a possible solution for each effect.
|
What were the probable causes of undervaluation
: The Argentine peso was fixed through a currency board at Ps1.00/$ throughout the 1990s. In January 2002, the Argentine peso was floated. On January 29, 2003 it was trading at Ps3.20/$. y what percentage was the Argentine peso undervalued? What were t..
|
Possesses some finite amount of magical energy
: A spellcaster is given an object (e.g. mouse, owl, dwarf, purse ...) and a set of spells that she / he can use to transform the object. The effect of each spell is described by a set of from-to pairs. For example, spell "Chiroptera" may transform ob..
|
Using professional-style writing
: In your proposal, explain to your boss (using professional-style writing) the reasons for your choice. Include the concepts that are covered in Chapters 7 and 8 as reasons for or against the use of the training tutorials or videos or modules or your ..
|
Discuss an important characteristic of a good overhead
: Discuss an important characteristic of a good overhead allocation base.
|
Initial investment because of the chinese revaluation
: Cnooc, a Chinese public-sector company, has made a bid to purchase Unocal, a big U.S oil company, for $18.5 billion in June 2005. Treat this as an initial investment made by Cnooc in this two-year, U.S based project. If it now purchased Unocal in Au..
|
Obesity in the uk as a health problem with statistics
: Analyse obesity in the uk as a health problem with statistics, the main body should include 3 effects of this problem and for each problem should be practical solution and evaluation.
|