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...
-
Explain briefly the items generally included in a companys annual report. (You may use the financial statements appearing in Appendix A to support your answer.)
-
If a group of 200 IDDM 30- to 39-year-old men is followed, what is the probability that exactly 2 will go blind over a 1-year period? Ophthalmology, Diabetes A study [12] of incidence rates of...
-
What is accounting period concept?
-
Sales mix, two products. The Goldman Company retails two products: a standard and a deluxe version of a luggage carrier. The budgeted income statement for next period is as follows: 1. Compute the...
-
Required information Skip to question [ The following information applies to the questions displayed below. ] Iguana, Inc., manufactures bamboo picture frames that sell for $ 2 0 each. Each frame...
-
The data displayed in the plot below are from a nearly complete record of body masses of the worlds native mammals (in grams, then converted to log-base 10; Smith et al. 2003). The data were divided...
-
Company G, which has a 30 percent marginal tax rate, owns a controlling interest in Company J, which has a 12 percent marginal tax rate. Both companies perform engineering services. Company G is...
-
3. Explain the Geometric Transformations used in image restoration. 4.Describe homomorphic filtering
-
5.Explain the different Noise Distribution in detail. UNIT I V 1. What is segmentation? 2. Write the applications of segmentation. 3. What are the three types of discontinuity in digital image? 4....
-
6. What are the two properties used for establishing similarity of edge pixels? 7. What is edge? 8. Give the properties of the second derivative around an edge? 9. Define Gradient Operator? 10. What...
-
14. Define pattern. , 15. Define pattern class. 16. List the three pattern arrangements. 17. Give the decision-theoretic methods. 18. Define the training pattern and training set. 19. Define training...
-
1. Write short notes on image segmentation. 2. Write short notes on edge detection 3.Write Short notes on edge linking by local processing.
-
do both please for a thumb up You have an investment account that started with $4,000 10 years ago and which now has grown to $6,000. a. What annual rate of return have you earned (you have made no...
-
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...
-
Can you taste PTC? PTC is a substance that has a strong bitter taste for some people and is tasteless for others. The ability to taste PTC is inherited. About 75% of Italians can taste PTC, for...
-
Teens and their TV sets According to a Gallup Poll report, 64% of teens aged 13 to 17 have TVs in their rooms. Here is part of the footnote to this report: These results are based on telephone...
-
Explain how the t distributions are different from the standard Normal distribution and why it is necessary to use a t distribution when calculating a confidence interval for a population mean.
Study smarter with the SolutionInn App