Dynamo is an incredible magician. He will be performing this new magic trick in the Blackpool Magician Convention. His magic trick consists of N acts labelled from 1 to N. Every act except act 1 is...


Dynamo is an incredible magician. He will be performing this new magic trick in the Blackpool<br>Magician Convention. His magic trick consists of N acts labelled from 1 to N. Every act except act 1 is<br>directly dependent upon the successful execution of exactly one of the previous acts. The act i is said<br>to be dependent upon act j if and only if:<br>Act i is directly dependent upon the act j (j < i) or<br>Act i is dependent upon some act x which is dependent upon the act j. (j < x < i)<br>An act can never happen if one or more of its dependencies failed. Also, every act has an associated<br>value ai which gets added to the audience's anger if that act fails. If the anger becomes very large,<br>people will start throwing sharp objects at Dynamo. Since he is going to perform in the Blackpool<br>Magician Convention, he is interested in knowing the minimum possible anger value of audience in<br>the hypothetical situation where he was able to successfully execute exactly K acts during his<br>performance. Develop a C++ code that prints a line containing the minimum anger value of audience<br>if Dynamo could perform exactly K of the acts successfully.<br>Test Case 1<br>Output 1<br>4<br>53<br>15<br>24<br>26<br>38<br>

Extracted text: Dynamo is an incredible magician. He will be performing this new magic trick in the Blackpool Magician Convention. His magic trick consists of N acts labelled from 1 to N. Every act except act 1 is directly dependent upon the successful execution of exactly one of the previous acts. The act i is said to be dependent upon act j if and only if: Act i is directly dependent upon the act j (j < i)="" or="" act="" i="" is="" dependent="" upon="" some="" act="" x="" which="" is="" dependent="" upon="" the="" act="" j.="" (j="">< x="">< i)="" an="" act="" can="" never="" happen="" if="" one="" or="" more="" of="" its="" dependencies="" failed.="" also,="" every="" act="" has="" an="" associated="" value="" ai="" which="" gets="" added="" to="" the="" audience's="" anger="" if="" that="" act="" fails.="" if="" the="" anger="" becomes="" very="" large,="" people="" will="" start="" throwing="" sharp="" objects="" at="" dynamo.="" since="" he="" is="" going="" to="" perform="" in="" the="" blackpool="" magician="" convention,="" he="" is="" interested="" in="" knowing="" the="" minimum="" possible="" anger="" value="" of="" audience="" in="" the="" hypothetical="" situation="" where="" he="" was="" able="" to="" successfully="" execute="" exactly="" k="" acts="" during="" his="" performance.="" develop="" a="" c++="" code="" that="" prints="" a="" line="" containing="" the="" minimum="" anger="" value="" of="" audience="" if="" dynamo="" could="" perform="" exactly="" k="" of="" the="" acts="" successfully.="" test="" case="" 1="" output="" 1="" 4="" 53="" 15="" 24="" 26="">

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here