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...
-
Hughes Foods completed the following selected transactions. 2016 Oct 31 Sold goods to BiLo's Foods, receiving a $36,000, three-month, 4.5% note. (You do not need to make the cost of goods sold...
-
Consider the Bayes model By performing the following steps, obtain the empirical Bayes estimate of . (a) Obtain the likelihood function (b) Obtain the mle ^ of for the likelihood m(x|). (c) Show...
-
How do the margin requirements for a small retail trader differ from those for a member of the exchange clearinghouse?
-
Can a Foreign Target Be Assessed Like Any Other Asset? Point Yes. The value of a foreign target to an MNC is the present value of the future cash flows to the MNC. The process of estimating a foreign...
-
What is Photosynthesis?
-
For the plane trusses supported by the spring at node 1 in Figure P3-33 (a) and (b), determine the nodal displacements and the stresses in each element. Let E = 210 GPa and A 5.0 10-4 m2 for both...
-
At the beginning of 2011, the Kingdom of Saudi Arabia began the procedures for the transition from the application of Saudi accounting standards to the application of International Financial...
-
Risk management often brings up ethical issues for project managers. For instance, software testing can be done in several different ways and with several different levels of rigor and...
-
What is the formal system and sound formal system. Make an explanation with examples
-
A fatigue test was conducted in which the mean stress was 90 MPa (13050 psi), and the stress amplitude was 230 MPa (33360 psi}. a. Compute the maximum stress level. b. Compute the minimum stress...
-
Determine and Use Overhead Rate Cortez Consulting, Inc., expects the following costs and expenses during the coming year: Direct labor (@ $22.50/hr.) $81,000 Sales commissions 18,500 Overhead 72,000...
-
Roll (1984) assumes that the price, pt, of an asset follows where f is a constant fundamental price, s is the bid-ask spread and It is a binary indicator variable given by It S Pt = f + It = +1, with...
-
24. The club of the preceding exercise has two members named Jack and Jill. They have calculated that 2,380 of the committees have Jack on them, 2,380 have Jill, 1,820 have Jack but not Jill, 1,820...
-
In Problems 718, write the augmented matrix of the given system of equations. f0.01x0.03y = 0.06 [0.13x + 0.10y = 0.20
-
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...
-
Which of the following is a correct statement? (a) There is a business directory which defines all segments of all companies. (b) The decision on defining segments for reporting is a matter for the...
-
Which of the following statements describes the Global Reporting Initiative? (a) A law that applies throughout Europe requiring international accounting standards to be used. (b) A law that applies...
-
. Which of the following is an example of off-balance sheet finance? (a) The unconditional sale of a building to an unrelated company. (b) Borrowing on overdraft from a bank. (c) Borrowing secured on...
Study smarter with the SolutionInn App