You are performing a science experiment in a research laboratory. You are attempting to form a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are performing a science experiment in a research laboratory. You are attempting to form a new compound. A compound is made up of molecules and the mass of the compound is the sum of the masses of the molecules that compose the compound. For this experiment, you have identified four types of molecules: A, B, C and D. From these four molecules, A and B are monatomic, but C and D are diatomic. A monoatomic molecule is made up of one atom, but a diatomic molecule is made up of two atoms. So the mass of a diatomic molecule is twice its atomic mass while the mass of a monoatomic molecule is equal to its atomic mass. You have to form a compound X of mass Q using the maximum number of molecules. Write an algorithm to find the maximum number of molecules that can be used to form compound X. Input The first line of the input consists of an integer - atomicMassA, representing the atomic mass of atom A. The second line consists of an integer - atomicMassB, representing the atomic mass of atom B. The third line consists of an integer - atomicMassC, representing the atomic mass of atom C. The fourth line consists of an integer - atomicMassD, representing the atomic mass of atom D. The last line consists of an integer - atomicMassX, representing the atomic mass of compound X. Output Print an integer representing the maximum number of molecules that can be used to form compound X. Constraints 1 ≤ atomicMassA, atomicMassB, atomicMassC, atomicMassD ≤ 105 1 ≤ atomicMassX ≤ 107 Note You have an unlimited supply of the molecules. Molecules cannot be broken down into smaller units. Example Input: 5 8 5 3 23 Output: 4 Explanation: Molecular mass of a A-molecule(monoatomic) = 5 Molecular mass of a B-molecule(monoatomic) = 8 Molecular mass of a C-molecule(diatomic) = 10(5*2) Molecular mass of a D-molecule(diatomic) = 6(3*2) The best optimal fusion is to use three D molecules (6*3) and one A molecule (51) to create X of mass 23 (18+5). Hence, the total number of molecules used are 4. (a 亩三分地 You are performing a science experiment in a research laboratory. You are attempting to form a new compound. A compound is made up of molecules and the mass of the compound is the sum of the masses of the molecules that compose the compound. For this experiment, you have identified four types of molecules: A, B, C and D. From these four molecules, A and B are monatomic, but C and D are diatomic. A monoatomic molecule is made up of one atom, but a diatomic molecule is made up of two atoms. So the mass of a diatomic molecule is twice its atomic mass while the mass of a monoatomic molecule is equal to its atomic mass. You have to form a compound X of mass Q using the maximum number of molecules. Write an algorithm to find the maximum number of molecules that can be used to form compound X. Input The first line of the input consists of an integer - atomicMassA, representing the atomic mass of atom A. The second line consists of an integer - atomicMassB, representing the atomic mass of atom B. The third line consists of an integer - atomicMassC, representing the atomic mass of atom C. The fourth line consists of an integer - atomicMassD, representing the atomic mass of atom D. The last line consists of an integer - atomicMassX, representing the atomic mass of compound X. Output Print an integer representing the maximum number of molecules that can be used to form compound X. Constraints 1 ≤ atomicMassA, atomicMassB, atomicMassC, atomicMassD ≤ 105 1 ≤ atomicMassX ≤ 107 Note You have an unlimited supply of the molecules. Molecules cannot be broken down into smaller units. Example Input: 5 8 5 3 23 Output: 4 Explanation: Molecular mass of a A-molecule(monoatomic) = 5 Molecular mass of a B-molecule(monoatomic) = 8 Molecular mass of a C-molecule(diatomic) = 10(5*2) Molecular mass of a D-molecule(diatomic) = 6(3*2) The best optimal fusion is to use three D molecules (6*3) and one A molecule (51) to create X of mass 23 (18+5). Hence, the total number of molecules used are 4. (a 亩三分地
Expert Answer:
Answer rating: 100% (QA)
Here is the algorithm 1 Read the input atomic masses of A B C D and total mass of compound ... View the full answer
Related Book For
Cambridge International AS And A Level Chemistry Coursebook
ISBN: 9781316637739
2nd Edition
Authors: Lawrie Ryan, Roger Norris
Posted Date:
Students also viewed these accounting questions
-
What is the break-even point for this organization? List expenses assigned as variable and fixed. Show the calculations. (Net Operating Revenue - Variable Costs = Contribution Margin. Contribution...
-
The following scenario was written by a reporter who became a Taco Bell worker for a few hours to experience what its like to work in the drive-thru window at one of the most high-tech, quick-serve...
-
The DNA molecule is made up of two linked strands which together form a helix. The links between the strands are provided by bonds between pairs of chemicals called bases . There are four such bases,...
-
8) Implement a class UserNames which requires an ArrayList of names (user names), consider the following static methods methods: initilizeUserName(), deleteUserName(), addUserName() and display...
-
Mary Walker sells homemade knit scarves for $25 each at local craft shows. Her contribution margin ratio is 60%. Currently, the craft show entrance fees cost Mary $1,500 per year. The craft shows are...
-
Describe what happens to the graph of y = x2 in the following situations. a. x is replaced with (x - 3). b. x is replaced with (x + 3). c. y is replaced with (y - 2). d. y is replaced with (y + 2).
-
Presented here is information for Eliason, Inc., for the year ended August 31,2010. Beginning: Assets. Liabilities... Ending: Assets....... Liabilities. Stockholders' Equity: Sale of Stock .............
-
Eagle Electronics must expand by building a second facility. The search has been narrowed down to locating the new facility in one of four cities: Atlanta (A), Baltimore (B), Chicago (C), or Dallas...
-
On April 30, the bank reconciliation of Lily Company shows three outstanding checks: no. 254, $640; no. 255, $860; and no. 257, $500. The May bank statement and the May cash payments journal show the...
-
You are creating a customer database for the Lehigh Valley IronPigs minor league baseball team. Draw a project network given the information below. Complete the forward and backward pass, compute...
-
QUESTIONS A teacher and two research assistants at Istanbul Esenyurt University want to do a research project on the cleanliness of the lake and the diversity of fish in Bykekmece lake. In this...
-
Below is an example of what an answer should look like if you had been asked to provide information on the Process element of the extended marketing mix. What is ' process' ? Jones (2009) states...
-
Allegiant Airlines Case Study Allegiant almost had a monopoly on its market. How did Allegiant avoid competition with low-cost and other ultra-low-cost competitors? Explain Allegiant's revenue model...
-
Determine two performance criteria for monitoring the strategic marketing performance of a company of your choice. 2). Take a position on whether it is still important to perform a marketing audit on...
-
Evaluate the marketing mix elements of the 4 Ps of product, place, price, and promotion. How well do these marketing mix elements contribute to B Honey and the Purple Hive Project s brand equity ?
-
1. As a Marketing Manager with responsibility for staff, describe three (3) issues that you see as most likely to create boundary-spanning problems for employees in a customer call center at your...
-
A shortfall of $12,000 has been estimated in the lump sum available upon retirement in 20 years. How much regular savings at the end of each year over the next 20 years is required to cover this...
-
What are the key dimensions of critical thinking 2. Watch the NBC Learn video on Diet Scams. What types of claims are made in this video Are they valid Elaborate on your responses. Discuss this video...
-
For each of the following reactions, suggest whether the entropy of the reactants or the products will be greater or whether it is difficult to decide. Explain your answers. a. NH 3 (g) + HCl(g) NH...
-
Aluminium reacts with hydrochloric acid to form aluminium chloride, AlCl 3 , and hydrogen. This is a redox reaction. a. Explain in term of electrons, what is meant by a redox reaction. b. i. Write a...
-
a. Place these molecules in order of ease of nitration, with the most reactive first: C 6 H 6 C 6 H 5 CH 3 C 6 H 5 COOH C 6 H 5 OH b. i. Write a balanced equation to show the reaction when excess...
-
A company is scheduling temporary differences for the purpose of computing deferred taxes. The company compared tax basis assets and liabilities with book basis assets and liabilities and accumulated...
-
A company is scheduling its temporary differences for the purpose of computing deferred taxes. The company compared tax basis assets and liabilities with book basis assets and liabilities and...
-
Derive the look-up table for the tangent function in increments of 1 degree. Be sure to take advantage of symmetry.
Study smarter with the SolutionInn App