文件名称:tingche
介绍说明--下载内容均来自于网络,请自行研究使用
1 问题描述
设有一个可以停放n辆汽车的狭长停车场,它只有一个大门可以供车辆进出。车辆按到达停车场时间的早晚,依次从停车场最里面向大门口处停放。如果停车场已放满n辆车,则后来的车辆只能在停车场大门外的便道上等待,一旦停车场内有车开走,则排在便道上的第一辆车就进入停车场。停车场内如有某辆车要开走,在它之后进入停车场的车都必须退出停车场为它让路,待其开出停车场后,这些车辆再依原来的次序进场。每辆车在离开停车场时,都应根据它在停车场内停留的时间长短来交费。如果停留在便道上的车未进入停车场就要离去,允许其离开,不收停车费,并且仍然保持在便道上等待的车辆次序。编制一个程序模拟该停车场的管理。
2 实现要求
要求程序输出每辆车到达后的停车位置(停车场或便道),以及某辆车离开停车场时应该交纳的费用和它在停车场内停留的时间。
3 实现提示
汽车的模拟输入信息格式可以为:(到达/离开,汽车牌照号码,到达/离开的时间)。用栈和队列来模拟停车场和便道。
-A descr iption of the problem
N has a vehicle that can accommodate a narrow parking lot, it has only one door can be used for vehicle access. Parking of vehicles arriving in time for morning and evening, followed by the inside from the parking lot at the entrance to the park. N If the parking lot filled with cars, then the later cars can only be the sidewalk in the parking lot outside the gate waiting for, once the car park a car drive away, then came in the first car on the sidewalk on the entry. Car parks, if certain vehicles to drive away, in the car after it entered the car park must make way for it out of parking lot, until their out car park, these vehicles, and then the order in accordance with the original approach. When the vehicle left the parking lot should be based on its stay in the car park within the length of time Contributions. If you stay in the car on the sidewalk should not enter the parking lot to leave, allowing it to leave, do not charge parking fees, and still
设有一个可以停放n辆汽车的狭长停车场,它只有一个大门可以供车辆进出。车辆按到达停车场时间的早晚,依次从停车场最里面向大门口处停放。如果停车场已放满n辆车,则后来的车辆只能在停车场大门外的便道上等待,一旦停车场内有车开走,则排在便道上的第一辆车就进入停车场。停车场内如有某辆车要开走,在它之后进入停车场的车都必须退出停车场为它让路,待其开出停车场后,这些车辆再依原来的次序进场。每辆车在离开停车场时,都应根据它在停车场内停留的时间长短来交费。如果停留在便道上的车未进入停车场就要离去,允许其离开,不收停车费,并且仍然保持在便道上等待的车辆次序。编制一个程序模拟该停车场的管理。
2 实现要求
要求程序输出每辆车到达后的停车位置(停车场或便道),以及某辆车离开停车场时应该交纳的费用和它在停车场内停留的时间。
3 实现提示
汽车的模拟输入信息格式可以为:(到达/离开,汽车牌照号码,到达/离开的时间)。用栈和队列来模拟停车场和便道。
-A descr iption of the problem
N has a vehicle that can accommodate a narrow parking lot, it has only one door can be used for vehicle access. Parking of vehicles arriving in time for morning and evening, followed by the inside from the parking lot at the entrance to the park. N If the parking lot filled with cars, then the later cars can only be the sidewalk in the parking lot outside the gate waiting for, once the car park a car drive away, then came in the first car on the sidewalk on the entry. Car parks, if certain vehicles to drive away, in the car after it entered the car park must make way for it out of parking lot, until their out car park, these vehicles, and then the order in accordance with the original approach. When the vehicle left the parking lot should be based on its stay in the car park within the length of time Contributions. If you stay in the car on the sidewalk should not enter the parking lot to leave, allowing it to leave, do not charge parking fees, and still
(系统自动生成,下载前可以参看下载内容)
下载文件列表
停车1.cpp