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
#3
Yes,of course.We have 7 vaccant rooms with room numbers 3,6,8,12,16,21,28. So the distances between those rooms are 3,2,4,4,5,7 accordingly. The number of tourist is 4 as it's given in the first row of input. For example,first two tourists we check into rooms with numbers 3 and 28. Then we have to check into rooms two last tourists so that the distance between them and first two tourists would be as long as possible. The best decision is to provide the third tourist a 12th room, the fourth tourist the 21st room. All in all, tourist №1 is checked into room number 3, №2 - 12,№3 - 21, №4- 28. The distance between those rooms is 9,9,7. The minimum is 7 and that's the answer
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