Alice has invented a new card game to play with Bob. Alice made a deck of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Alice has invented a new card game to play with Bob. Alice made a deck of cards with random values between 1 and 52. Bob picks 5 cards. Then, he has to rearrange the cards so that by utilizing the operations plus, minus, or times, the value of the cards reach Alice's favorite number, 42. More precisely, find operations such that ((vall op1 val2) op2 val3) op3 val4) op4 val5) = 42. Help Bob by writing a program to determine whether it is possible to reach 42 given 5 card values. For example, Bob picks 5 cards out of the deck containing 40, 1. 3, 4, and 20. Bob rearranges the cards and supplies four operations, so that 4 * 20 - 40 + 3 -1 = 42. Input: The input consists of five integers on a line, separated by spaces. Each integer is between 1 and 52, inclusive. Output: Print a line containing "YES" if it is possible to reach the value 42 according to the rules of the game, or "NO" otherwise. Test 1 Test Input D 40 1 3 4 20 Expected Output B YES Alice has invented a new card game to play with Bob. Alice made a deck of cards with random values between 1 and 52. Bob picks 5 cards. Then, he has to rearrange the cards so that by utilizing the operations plus, minus, or times, the value of the cards reach Alice's favorite number, 42. More precisely, find operations such that ((vall op1 val2) op2 val3) op3 val4) op4 val5) = 42. Help Bob by writing a program to determine whether it is possible to reach 42 given 5 card values. For example, Bob picks 5 cards out of the deck containing 40, 1. 3, 4, and 20. Bob rearranges the cards and supplies four operations, so that 4 * 20 - 40 + 3 -1 = 42. Input: The input consists of five integers on a line, separated by spaces. Each integer is between 1 and 52, inclusive. Output: Print a line containing "YES" if it is possible to reach the value 42 according to the rules of the game, or "NO" otherwise. Test 1 Test Input D 40 1 3 4 20 Expected Output B YES
Expert Answer:
Answer rating: 100% (QA)
Code include using namespace std typedef long long ll int ... View the full answer
Related Book For
Statistics Data Analysis and Decision Modeling
ISBN: 978-0132744287
5th edition
Authors: James R. Evans
Posted Date:
Students also viewed these mathematics questions
-
Determine whether it is possible that any of the population proportions in Exercise 21 are equal and explain your reasoning. Exercise 21 Construct a 99% confidence interval for the population...
-
A young entrepreneur has invented a new air-adjustable basketball shoe with pump, similar to those advertised widely by more expensive brand names. He contacted a supplier of Victor basketball shoes,...
-
For each of the following firms, determine whether it is more likely to use job order or process costing. This firm a. Provides legal services. b. Is a health-care clinic. c. Manufactures shampoo. d....
-
A communal vegetable garden has been set up by the council for 68 members of a small self- sustaining community. Each of the 68 members can either contribute towards taking care of the garden or...
-
Convince yourself that the maximum and minimum values of a linear function ((x, y) = ax + by + c over a closed polygonal set (i.e., a polygon and its interior) will always occur at a vertex of the...
-
What are the SQL built-in functions? How do you use them in an SQL query?
-
What are the two categories of data mining and knowledge discovery software?
-
BBB Companys balance sheet and income statement follow: Required a. Prepare a statement of cash flows for the year ended December 31, 2009. (Present the cash flows from operations using the indirect...
-
An ATV has an average acceleration of 1.9 m/s 2 . If the vehicle accelerates for 5.8 s and has an initial velocity of 15 m/s [E], what is the final velocity of the ATV?
-
A vertical frictionless piston-cylinder device contains 50 kg of steam at 200 kPa and 300C. Determine the heat transfer and the work done during the process if the steam is cooled at constant...
-
Oregon Manufacturing had the following data for the past three months. January February March Sales in units 3000 3,750 4,500 Operating expenses $272,000 $296,000 $320,000 1. Using the high-low...
-
Kevin purchases 1,000 shares of Bluebird Corporation stock on October 3, 2018, for $340,000. On December 12, 2018, Kevin purchases an additional 750 shares of Bluebird stock for $238,000. According...
-
1. In your opinion, how do major pandemics, like the COVID-19 pandemic; natural disasters; and other outside influences impact the hospitality industry in your community? What could be done to combat...
-
Labracorp is looking to hire an unknown number of workers. Jim wants to be one of those workers. If Labracorp's total revenue is less than its total cost if Jim's marginal revenue is greater than his...
-
Benson Electronics currently produces the shipping containers it uses to deliver the electronics products it sells. The monthly cost of producing 9,000 containers follows: Unit-level materials $...
-
Perform research on ethical issues concerning grant proposals. Identify and discuss at least two ethical concerns when developing a grant proposal or new program. Explain how this can be avoided or...
-
Considering the various uncontrollable environments that affect organizations, choose an industry and identify how each of the following might generally affect global supply chains: (a) economic; (b)...
-
In Problems 1522, find the principal needed now to get each amount; that is, find the present value. To get $750 after 2 years at 2.5% compounded quarterly.
-
What are the differences between one and twosample hypothesis tests? Describe the correct mathematical form for specifying the null and alternative hypotheses for both types of tests.
-
How are standard residuals calculated, and how can they help identify outliers?
-
Using data in the Excel file Colleges and Universities, find 95% confidence intervals for the standard deviation of the median SAT for each of the two groups: liberal arts colleges and research...
-
Find the conditional \(p d f\) for one discrete random variable given the value of another and their joint \(p d f\).
-
Define the covariance and correlation between two random variables, and compute these values given a joint probability function of two discrete random variables.
-
Give an intuitive explanation of statistical independence of two random variables, and state the conditions that must hold to prove statistical independence. Give examples of two independent random...
Study smarter with the SolutionInn App