Question
The current cash withdrawal limit in Egypt is 20,000 EGP per day. Due to the economic issues in Egypt, the government decided to put a
The current cash withdrawal limit in Egypt is 20,000 EGP per day. Due to the economic issues in Egypt, the government decided to put a further limit on how much cash we can actually withdraw from one ATM on a given day. So now even though we can still withdraw 20K total, we are only allowed to withdraw a maximum of 10K from any particular ATM on a given day. Kareem is used to withdrawing cash late at night after work. He is usually concerned about walking around with cash late at night. So he usually goes to any ATM (assume the work bus will drop him off at any ATM he likes), withdraws cash, then takes an Uber home. One day he realizes he needs more than 10K. With the new rules, he will now need two Ubers, as he will go to the first ATM to withdraw 10K, then take an Uber to the next ATM to withdraw the remaining amount, then take a second Uber home. However, Kareem wants to keep it at only one Uber trip. This means he will have to walk from ATM 1 to ATM 2 before taking an Uber home. As he is not comfortable with walking with a lot of cash at night, he decides that the best thing would be to minimize the distance between both ATMs. So he pulls up Google maps and looks up the coordinates of all ATMs that are in the neighborhood where he could withdraw cash from. Since Kareem lives in an area that has A LOT of ATMs, he is now overwhelmed with the amount of data and does not know what is the quickest way to specify the two ATMs he is looking for. He only knows how to do it brute force but it takes too long. So he asks you to help. Given the list the (x,y) coordinates of Kareems ATMs, write an algorithm that outputs the two ATMs Kareem should pick. Explain to Kareem why your algorithm is a better way to find an answer, as opposed to his naive approach.
write a c++ code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started