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, 23.06.2019 15:30
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
What would be the address of the cell, which is at the intersection of the second row and the third column in a worksheet?
Answers: 1
question
Computers and Technology, 24.06.2019 01:10
Create a program that will take in a single x and y coordinate as the origin. after the input is provided, the output should be all of the coordinates (all 26 coordinates read from the “coordinates.json” file), in order of closest-to-farthest from the origin.
Answers: 1
question
Computers and Technology, 24.06.2019 10:50
In 2009 to 2010, how many social network users were reported as being victims of online abuse? a. 1 in 10 b. 100% c.1 in 100 d. 50%
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
question
Mathematics, 02.11.2020 22:40
question
Mathematics, 02.11.2020 22:40
question
Mathematics, 02.11.2020 22:40
question
Mathematics, 02.11.2020 22:40
question
Mathematics, 02.11.2020 22:40
question
Social Studies, 02.11.2020 22:40
Questions on the website: 13722362