C++ Code Mr. Naughty loves to play with balls. So, his friend, Mr. Nice, gave him n balls to play the game. Each ball has exactly two numbers (more number and number below). In one move Mr. Naughty can rotate any ball that its bottom is now rising. Mr. Nice knows a small amount of this movements that can make at least half of the balls show the same number at the top. So, in order to win Mr Nice's game, Mr. Naughty has to earn a small amount of it it goes. It is not always possible to make such movements that satisfy what is provided in this case Mr. Naughty should see that it is "Impossible" to make such movements. Help Mr. Naughty win the game. Input 3 3 100 100 3 54 Output 5 сл

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section: Chapter Questions
Problem 12RP
icon
Related questions
Question
C++ Code
Mr. Naughty loves to play with balls. So, his friend, Mr. Nice, gave him n balls to play the game. Each
ball has exactly two numbers (more number and number below). In one move Mr. Naughty can
rotate any ball that its bottom is now rising. Mr. Nice knows a small amount of this movements that
can make at least half of the balls show the same number at the top.
So, in order to win Mr Nice's game, Mr. Naughty has to earn a small amount of it it goes. It is not
always possible to make such movements that satisfy what is provided in this case Mr. Naughty
should see that it is "Impossible" to make such movements. Help Mr. Naughty win the game.
Input
3
3 100
100 3
54
Output
5
Transcribed Image Text:C++ Code Mr. Naughty loves to play with balls. So, his friend, Mr. Nice, gave him n balls to play the game. Each ball has exactly two numbers (more number and number below). In one move Mr. Naughty can rotate any ball that its bottom is now rising. Mr. Nice knows a small amount of this movements that can make at least half of the balls show the same number at the top. So, in order to win Mr Nice's game, Mr. Naughty has to earn a small amount of it it goes. It is not always possible to make such movements that satisfy what is provided in this case Mr. Naughty should see that it is "Impossible" to make such movements. Help Mr. Naughty win the game. Input 3 3 100 100 3 54 Output 5
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole