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]
3 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]3 years ago
3 0

Answer:

ask it to ur teacher boiiiiii

You might be interested in
Array Basics pls help
posledela

Answer:

import java.util.Random;

class Main {

 static int[] createRandomArray(int nrElements) {

   Random rd = new Random();

   int[] arr = new int[nrElements];

   for (int i = 0; i < arr.length; i++) {

     arr[i] = rd.nextInt(1000);

   }

   return arr;

 }

 static void printArray(int[] arr) {

   for (int i = 0; i < arr.length; i++) {

     System.out.println(arr[i]);

   }

 }

 public static void main(String[] args) {

   int[] arr = createRandomArray(5);

   printArray(arr);

 }

}

Explanation:

I've separated the array creation and print loop into separate class methods. They are marked as static, so you don't have to instantiate an object of this class type.

5 0
2 years ago
When molten igneous material intrudes into rock _____ metamorphism can occur.
Fittoniya [83]
Contact metamorphism can occur. 

B)
5 0
4 years ago
Which element of a presentation program’s interface displays the slide you are currently creating or editing?
irinina [24]

I believe the answer is: Slide Plane

5 0
3 years ago
Read 2 more answers
Can someone scan this QR code. I'm on PC and I cant scan it right now. Please tell me what it is.
barxatty [35]

Answer: It's a RickRoll'D Video

Explanation:

4 0
3 years ago
Given a circle has perimeter (circumference) of 27.561,what is the radius?
vekshin1
The radius is r≈4.39
3 0
3 years ago
Other questions:
  • Create a variable ‘temp’ and assign the value in Celsius. Display the message ‘It’s extremely hot day today!’ if the temperature
    8·1 answer
  • Figuring out why your computer won't turn on falls under diagnosing.<br> A. True<br> B. False
    15·2 answers
  • What is a PowerPoint template?
    6·2 answers
  • Lucy is completing a project as part of a science class using materials she found online. Which of the following is MOST LIKELY
    5·1 answer
  • Create a class Str that subclasses str. Add a method to the subclass that checks if the string does not start with a given strin
    15·1 answer
  • What is a computer?
    9·2 answers
  • An ip address in the address range 169.254.x.y, used by a computer when it cannot successfully lease an ip address from a dhcp s
    6·1 answer
  • PLEASE HELP!!!
    11·2 answers
  • This is really dumb but can someone help me find these memes? I can’t remember what they’re called but I remember how they went
    14·2 answers
  • Which statement best characterizes under what circumstances you should add your social media profile to a resume? You should add
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!