Computers and Technology

Rob anderson is creating a spooky decoration for halloween. rob has a bracket in the ceiling, and he will hook on chain links to make a drooping chain to give his room a dungeony feel. rob has a large collection of chain links to make the decoration. each link has a particular grade, which represents the amount of weight (in chain links, all of which have equal weight) that can be hung from it without breaking. a grade of weight 0 means that any link hung underneath will snap the link. rob’s roommate anne does understand the concepts of link grades, and was told by rob to hang up the links. anne will take each link (in order of rob’s collection) and hang it on the lowest hanging chain or on the bracket, if no chains are currently hanging from the ceiling. if a chain section falls to the ground anne will simply ignore it. this means that there is a very high chance that rob will come home to a large number of chain links (broken and not) lying on the floor. take in the grades of rob’s chain link collection, and determine how many links will break, which ones break, and how many chains should be hanging from the ceiling.

input specification: the input will contain multiple lines. the i-th line of input will contain a non-negative integer gi, representing the grade of the i-th link in the chain link collection. input will be terminated with a negative grade.

output specification: every time a link breaks, a line containing the phrase chain broken at link x. new height is y. should be printed, where x is the value representing the chain link in input that broke a link, and y is the number of chains currently hanging from the ceiling. the last 2 lines of output should be the following, ending chain height is x. there are y broken links and z whole links on the floor. the value x should be how many links are hanging from the ceiling, the value y will be how many links broke during annes link hanging, and z will be the number of links that never broke, but fell due to high links breaking.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:00, danthehero56
Which of the following is true of operations within a spreadsheet program’s built-in functions? a. operations within parentheses, then multiplication and division, and then addition and subtraction are computed. b. operations within parentheses, then addition and subtraction, and then multiplication and division are computed. c. multiplication and division, then addition and subtraction, and then operations within parentheses are computed. d. addition and subtraction, then multiplication and division, and then operations within parentheses are computed
Answers: 2
image
Computers and Technology, 22.06.2019 18:00, crimhill
When is it appropriate to use an absolute reference
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, smariedegray
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
image
Computers and Technology, 23.06.2019 07:30, barkonatree
What is the penalty for violating section 1201 of title 17 chapter 21 of the us code
Answers: 1
Do you know the correct answer?
Rob anderson is creating a spooky decoration for halloween. rob has a bracket in the ceiling, and he...

Questions in other subjects:

Konu
Mathematics, 27.03.2020 01:00
Konu
Spanish, 27.03.2020 01:00