This is problem about a ship caught in a terrible storm. Although there were thirty passengers...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This is problem about a ship caught in a terrible storm. Although there were thirty passengers on board, plus the captain, there was only enough room in the lifeboats for fifteen of them. As the captain was reluctant to leave anyone behind, she resolved to throw half of the passengers overboard before loading the boats. As it happens, half of the passengers had slighted the captain by not dining at her table during the cruise. The captain, in revenge, arranged all the passengers in a circle and began to count. Every n" passenger went overboard; naturally, the captain's friends were never chosen. Here is how the passengers were arranged (the captain's friends are shown with 0 and the enemies with 1: 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 0 0 Write a program to determine what the number n was. Start counting at the upper-left 0. A passenger is thrown overboard as soon as selected. Assume that the arrangement of the passengers is represented by an array; each element is an integer. Use additional arrays if you wish. Caution: Your solution should be really short (10-15 lines or so, excluding I/O). Excessively long solutions will be penalized. This is problem about a ship caught in a terrible storm. Although there were thirty passengers on board, plus the captain, there was only enough room in the lifeboats for fifteen of them. As the captain was reluctant to leave anyone behind, she resolved to throw half of the passengers overboard before loading the boats. As it happens, half of the passengers had slighted the captain by not dining at her table during the cruise. The captain, in revenge, arranged all the passengers in a circle and began to count. Every n" passenger went overboard; naturally, the captain's friends were never chosen. Here is how the passengers were arranged (the captain's friends are shown with 0 and the enemies with 1: 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 0 0 Write a program to determine what the number n was. Start counting at the upper-left 0. A passenger is thrown overboard as soon as selected. Assume that the arrangement of the passengers is represented by an array; each element is an integer. Use additional arrays if you wish. Caution: Your solution should be really short (10-15 lines or so, excluding I/O). Excessively long solutions will be penalized.
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that determines the value of n as described in the problemarrangement 00... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
Introduction The Bujagali Hydropower plant straddles the River Nile some 8 km downstream from Lake Victoria. Completed in 2012, it is a run of the river 250 MW plant that provides up to 50% of...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
All of the following companies manufacture toasters. The following costs were incurred by each company during September: Required: 1. What is the total conversion cost for Warner Co.? 2. What is the...
-
A box with a total surface area of 1.20 m2 and a wall thickness of 4.00 cm is made of an insulating material. A 10.0-W electric heater inside the box maintains the inside temperature at 15.0C above...
-
Design a supplier quality management process for Integrated Devices that focuses on the prevention of supplier defects.
-
Consider a binary equimolar mixture of acetone and chloroform at \(300 \mathrm{~K}\) and \(1 \mathrm{~atm}\). Because this mixture forms a binary azeotrope, methyl- \(n\)-pentyl ether solvent is used...
-
1. The following sentence appears early in this chapter: There are three reasons that most entrepreneurial ventures need to raise money during their early life: cash flow challenges, capital...
-
A steam turbine having an isentropic turbine efficiency of 90% drives an air compressor having an isentropic compressor efficiency of 85%. Steady-state operating data are provided on the figure....
-
Wildcat, Incorporated, has estimated sales (in millions) for the next four quarters as follows: Sales Q1 $ 155 Q2 Q4 Q3 $175 $195 $ 225 Sales for the first quarter of the year after this one are...
-
If you know that the company uses re-measurement method to translate its financial statements into foreign currency. Please match each of the given account with the kind of rate used in...
-
If 43x+2=16x+4, then x equals
-
Distance between the object and the eyepiece of a compound microscope is 18 cm. The focal length of its objective lense is .8cm and the eyepiece had a focal length of 2.3cm. The near point distance...
-
A pilot taxiing on the airport loses radio contact with ATC and then sees a flashing red light being shown at his aircraft from the Air Traffic Control Tower. What action should the pilot take?
-
Describe how to make a strong magnet out of an initially unmagnetized iron rod without using the earth or another bar magnet. Include in your instructions the materials one would need, how one could...
-
Explain the strategies of the following banks in the Maldives. 1. Bank of Maldives 2. Maldives Islamic Bank 3. Commercial Bank of Maldives 4. Bank of Ceylon 5. State Bank of India 6. Mauritius...
-
The plant and production benchmarking cost data on p. 6 of each issue of the Footwear Industry Report O provide solid indication of whether a company's total manufacturing costs are low enough to...
-
Draw and label the E and Z isomers for each of the following compounds: 1. CH3CH2CH==CHCH3 2. 3. 4. CH,CH2C CHCH2CH Cl CH3CH2CH2CH2 CH CH2CCCH2CI CHCH3 CH3 HOCH CH CCC CH O-CH C(CH
-
Barnes, the owner and operator of Blackacre, decided to cease farming operations and liquidate his holdings. Barnes sold fifty head of yearling Merino sheep to Billing and then sold Blackacre to...
-
Terry J. Cooke (plaintiff) is the former husband of defendant, Joni Quicker (Joni); defendant Allen John Quicker (John) is Jonis father. In the early 1980s John and Joni began a business distributing...
-
Teresa, Peter, and Walker were partners under a written agreement made in January that the partnership should continue for ten years. During the same year, Walker, being indebted to Smith, sold and...
-
If a shipment is needed in week 8 and the lead time on its arrival is always 3 weeks, when should the shipment be ordered?
-
If item Y is the parent of Z and item X is the parent of Y, which item is the finished good?
-
Maynard Associates has 62 units of a certain product on hand currently. The demand forecast for the next two planning periods is 25 units each period. Maynard Associ- ates has no plans for production...
Study smarter with the SolutionInn App