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 20:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Knowing that the central portion of link bd has a uniform cross sectional area of 800 mm2 , determine the magnitude of the load p for which the normal stress in link bd is 50 mpa. (hint: link bd is a two-force member.) ans: p = 62.7 kn
Answers: 2
question
Computers and Technology, 23.06.2019 07:00
Why is investing in a mutual fund less risky than investing in a particular company's stock? a. mutual funds only invest in blue-chip stocks. b. investments in mutual funds are more liquid. c. mutual funds hold a diversified portfolio of stocks. d. investments in mutual funds offer a higher rate of return.
Answers: 2
question
Computers and Technology, 23.06.2019 10:30
Would a ps4 wired controller work on an xbox one
Answers: 1
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: 13722359