subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Which of the following kinds of programs displays an online advertisement in a banner or pop-up window on webpages, email, or other internet service? e
Answers: 2
question
Computers and Technology, 22.06.2019 06:00
Pthe price of tickets in a group when a purchased in bulk can be found with the equation c=px+24 were c is the cost, p is the number of people,and x is the price per ticket. what is price of of each ticket if it costs $189 to buy tickets for 15 people ? a $8 b $24c $9d $11 show work
Answers: 1
question
Computers and Technology, 22.06.2019 14:30
The “rule of 72” is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
question
Computers and Technology, 23.06.2019 09:50
Allison and her group have completed the data entry for their spreadsheet project. they are in the process of formatting the data to make it easier to read and understand. the title is located in cell a5. the group has decided to merge cells a3: a7 to attempt to center the title over the data. after the merge, allison points out that it is not centered and looks bad. where would the title appear if allison unmerged the cells in an attempt to fix the title problem?
Answers: 2
You know the right answer?
Rob anderson is creating a spooky decoration for halloween. rob has a bracket in the ceiling, and he...
Questions
Questions on the website: 13722361