文件名称:4
介绍说明--下载内容均来自于网络,请自行研究使用
[问题描述] 设停车场是一个可停放n辆汽车的狭长通道,且只有一个大门可供汽车进出。汽车在停车场内按车辆到达时间的先后顺序,依次由北向南排列(大门在最南端,最先到达的第一辆车停放在车场的最北端),若车场内已停满n辆汽车,则后来的汽车只能在门外的便道上等候,一旦有车开走,则排在便道上的第一辆车即可开入;当停车场内某辆车要离开时,在它之后进入的车辆必须先退出车场为它让路,待该辆车开出大门外,其他车辆再按原次序进入车场,每辆停放在车场的车在它离开停车场时必须按它停留的时间长短交纳费用。试为停车场编制按上述要求进行管理的模拟程序。
[基本要求] 以栈模拟停车场,以队列模拟车场外的便道,按照从终端读入的输入数据序列进行模拟管理。每一组输入数据包括三个数据项:汽车“到达”或“离去”信息、汽车牌照号码以及到达或离去的时刻。对每一组输入数据进行操作后的输出信息为:若是车辆到达,则输出汽车在停车场内或便道上的停车位置;若是车辆离去,则输出汽车在停车场内停留的时间和应交纳的费用(在便道上停留的时间不收费)。栈以顺序结构实现,队列以链表结构实现。
-[Problem Descr iption] parking lots is an n vehicles parked narrow channel, and only one gate for vehicle access. Car in a car park by vehicles, time of arrival of the order in which they arranged from north to south (the door at the southernmost tip, the first arrival of the first car parked in the garage of the most northern end), if the vehicle has been parked inside cars full of n, then later the car only on the sidewalk outside the door waiting when a car drove off, then came in the first car on the pavement can be opened into as a car park cars to leave, after the entry of vehicles in its it must first withdraw from parking lots to make way for cars to be out of the gate, other vehicles, then the original sequence into the yard, each car parked in the garage when it leaves the car park must stay the length of time that it pay the cost. Test preparation for the car park according to the above requirements to manage simulation program.
[Basic requirements] to simulate the stack p
[基本要求] 以栈模拟停车场,以队列模拟车场外的便道,按照从终端读入的输入数据序列进行模拟管理。每一组输入数据包括三个数据项:汽车“到达”或“离去”信息、汽车牌照号码以及到达或离去的时刻。对每一组输入数据进行操作后的输出信息为:若是车辆到达,则输出汽车在停车场内或便道上的停车位置;若是车辆离去,则输出汽车在停车场内停留的时间和应交纳的费用(在便道上停留的时间不收费)。栈以顺序结构实现,队列以链表结构实现。
-[Problem Descr iption] parking lots is an n vehicles parked narrow channel, and only one gate for vehicle access. Car in a car park by vehicles, time of arrival of the order in which they arranged from north to south (the door at the southernmost tip, the first arrival of the first car parked in the garage of the most northern end), if the vehicle has been parked inside cars full of n, then later the car only on the sidewalk outside the door waiting when a car drove off, then came in the first car on the pavement can be opened into as a car park cars to leave, after the entry of vehicles in its it must first withdraw from parking lots to make way for cars to be out of the gate, other vehicles, then the original sequence into the yard, each car parked in the garage when it leaves the car park must stay the length of time that it pay the cost. Test preparation for the car park according to the above requirements to manage simulation program.
[Basic requirements] to simulate the stack p
(系统自动生成,下载前可以参看下载内容)
下载文件列表
4.doc