Home > Back-end >  [] ask bosses C data structure parking lot management issues
[] ask bosses C data structure parking lot management issues

Time:09-22

1. Problem description
Is equipped with a park n car, narrow parking lot, it is only one door can be used in and out of vehicles, vehicle from one to the time sequence of the parking lot at a park in the parking lot for gate (i.e., the first to reach the first car in the parking lot to park the inside), if the parking lot is full n car, the arriving vehicles only in a parking lot gate of the pavement waiting, once the parking lot car drive away, ranked the pavement can first car into the parking lot, parking lot if you have a car to drive away, in the car into the parking lot after it has to make way for the it must exit the parking lot, after being opened its parking lot, these vehicles again according to the order of the original approach, each car in the parking lot when you leave, should be based on its length of stay in the parking lot fee, don't stay on the sidewalk car parking taxes,
Basic requirements
2.(1) to stack simulation parking lot to queue simulation sidewalk outside the parking lot, according to the simulated management with terminal reads input data sequence, each set of input data includes three items: car "to" or "leave" information, license plate number and time of arrive or depart, for each set of input data to the output information of the operation: if a vehicle arrives, the output of a car in the parking lot or sidewalk parking place; If vehicle departure, and output the time duration of the car in the parking lot and should pay the cost of the stay time (on the pavement no charge),
(2) manage according to the data read from the terminal sequence, each set of input data includes three items: the car arrive or depart information, license plate number, car arrive or leave time, such as: (' A ', 1, 5), (' A ', 2, 10), (" D ", 1, 15),... , (' E ', 0, 0), arrive where 'A' means, 'D' said, 'E' end of said, output data is: if A vehicle arrives, the output of the car parking place; If a vehicle to leave, then output the time duration of the car in the parking lot and should pay the fees,

CodePudding user response:

Well, need to use the stack and queue to management more convenient

CodePudding user response:

Well, need to use the stack and queue to management more convenient
  • Related