Python Forum
Settle the tourists into their rooms
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Settle the tourists into their rooms
#1
There are several rooms in the same hall on the same side of the hall in the hotel. The distance between adjacent rooms equals 1 meter. You know which rooms are not vacant and which are. New group of tourist arrived and is waiting to check into.You want everyone to check into separate room so that the distance between the tourists' rooms would be as long as possible.
Input:First you enter the number of vacant rooms and the number of tourists
Then the vacant rooms' numbers
Output: One number- the possible maximum distance between tourists' rooms

Example:
Input:
7 4
3 6 8 12 16 21 28
Output:
7

Do not have a slightest idea how to perform that task((Maybe someone can at least think of action plan
Reply


Messages In This Thread
InterstingTask - by Katenn - Sep-30-2020, 10:01 PM
RE: InterstingTask - by Gribouillis - Oct-01-2020, 11:47 AM
RE: InterstingTask - by Katenn - Oct-01-2020, 12:03 PM
RE: InterstingTask - by perfringo - Oct-01-2020, 12:11 PM
RE: InterstingTask - by Gribouillis - Oct-01-2020, 02:04 PM
Settle the tourists into their rooms - by Katenn - Oct-04-2020, 07:55 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020