1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
makvit [3.9K]
2 years ago
14

Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, h

e discovers an arcade store that pays real cash for every game that the player wins - however, the store will only pay out once per game. The store has some games for which they will pay winners, and each game has its own completion time and payout rate. Thrilled at the prospect of earning money for his talent, Adam walked into the store only to realize that the store closes in 2 hours (exactly 120 minutes). Knowing that he cannot play all the games in that time, he decides to pick the games that maximize his earnings
Sample game board at the arcade GAME COMPLETION TIME (in minutes) PAYOUT RATE Pac-man 90 400 Mortal Kombat 10 30 Super Tetris 25 100 Pump it Up 10 40 Street Fighter II 90 450 Speed Racer 10 40
An acceptable solution is the one where it still picks the best earnings even when the list of games or completion times or payout rates change.
Question:
Write code in Java/Scala/Python to help Adam pick the sequence(s) of games that earn him the most money?.
Then, assume you have a variable list of games and their payout rates. What is the best way to pick the games that earn you the most?
Input Explanation
The first line of input is always an integer denoting many lines to read after the first line. In our sample test case, we have 6 in the first line and 6 lines after the first line, each having a game, completion_time and payout_rate.
In each data line, the game, completion_time and payout_rate are separated by a ','(comma).
The games board may change but the store still closes in 120 minutes.
Input
6
Pac-man,80,400
Mortal Kombat,10,30
Super Tetris,25,100
Pump it Up,10,40
Street Fighter II,90,450
Speed Racer,10,40
Output Explanation
Print the game names that earn him the most into the standard output in alphabetical order
Output
Mortal Kombat
Pump it Up
Speed Racer
Street Fighter II
Computers and Technology
1 answer:
ohaa [14]2 years ago
3 0

Answer:

ask it to ur teacher boiiiiii

You might be interested in
Is recursion ever required to solve a problem? What other approach can you use to solve a problem that is repetitive in nature?
Setler79 [48]

Answer:

No you can not tell that recursion is ever required to solve a problem.

Recursion is required when in the problem, the solution of the input depends on the solution of the subsets of the input.

Iteration is also another form of repetitive approach we follow to solve that kind of problems.

But the difference between recursion and iteration is :

  • In recursion we call the function repeatedly to return the result to next level.
  • In iteration certain bunch of instructions in a loop are executed until certain conditions met.

Explanation:

For example in the Fibonacci sequence problem, to find f_{n}, we need to compute f_{n-1} and f_{n-2} before that.

  • In case of recursion we just call the method Fibonacci(n) repeatedly only changing the parameter Fibonacci(n-1), that calculates the value and return it.

                           Fibonacci(n)

                           1. if(n==0 or n==1)

                           2.       return 1.

                           3.else

                           4.      return( Fibonacci(n-1)+Fibonacci(n-1) )

  • But in case of iteration we run a loop for i=2 to n, within which we add the value of current f_{i-1} and f_{i-2} to find the value of f_{i}

                           Fibonacci(n)

                           1. if(n<=2)

                           2.    result = 1

                           3.     else

                           4. result1 =1 and result2=1.

                           5.      {  result = result1 +result2.

                           6.         result1= result2.

                           7.         result2 = result.

                           8.      }

                           9.  output result.

8 0
3 years ago
What is folded card publishing?​
Alexeev081 [22]

Answer:

Folded card This layout type is for creating greeting cards by printing pages on a sheet and then folding the sheet to make the card. If you choose the Folded card layout, then sheet fold options are displayed. Select an option in the list to specify how you will fold your publication

Explanation:

3 0
2 years ago
Read 2 more answers
What is the correct sequence of the phases in the systems development life cycle?
HACTEHA [7]
1. Requirements gathering/analysis.
2. Design.
3. Development.
4. Testing.
5. Maintenance.
7 0
3 years ago
When you try to boot your computer it hangs after post?
Likurg_2 [28]
What are you trying to ask...
4 0
3 years ago
_________ cards contain a chip that can store a large amount of information as well as on a magnetic stripe for backward compati
wariber [46]

Answer:

Smart

Explanation:

The RFID or the radio frequency identification is an electronic device that stores information electronically. It stores and makes available the information which is stored electromagnetically, once the user is authenticated.

This technology is implemented in market places and other individual activities. It is implemented in cards called smart card for ease of payment transaction and promote online commerce (e-commerce). It is also implemented in smartphones.

3 0
3 years ago
Other questions:
  • Which of the following is NOT a component of a DFD?
    8·1 answer
  • Should organizations fear websites where consumers post negative messages about products or services? What actions can companies
    12·1 answer
  • (I made this up teehee) what anime is katski bakugo from
    15·2 answers
  • What's the inputs and outputs in a kitchen?
    14·1 answer
  • A data center needs to ensure that data is not lost at the system level in the event of a blackout. Servers must stay operable f
    6·1 answer
  • 1.
    13·1 answer
  • What is the main advantage of using a WYSIWYG("what you see is what you get")editor when constructing a website
    5·1 answer
  • Sabiendo que z1 = 10, z2 = 20, z3 =10 , z4 = 20, n1 = 1200 rpm.
    6·1 answer
  • Which of the phases of the software development life cycle (SDLC) would the following action take place in?
    9·1 answer
  • What represents a user’s specific preferences?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!