駐車場
車の駐車を管理する ParkingLot
クラスを作成してください。このクラスは複数の機能を持っています:車を駐車する、車を出庫する、そして残りの駐車スペースの数を報告できる必要があります。
駐車場に駐車できる車を表す Car
クラスを作成してください。
以下を実装する必要があります:
Car
クラス:car_id
属性を持ちます。この属性は車オブジェクトを作成するときに指定します。以降のすべての操作はこのcar_id
を考慮に入れる必要があります。ParkingLot
クラス:total_spots
attribute: the total number of parking spots in the parking lot, which should be provided when the parking lot object is created.park(car)
method: parks aCar
object in the parking lot. If the parking lot is full, it should printParking lot is full
.release(car)
method: releases aCar
from the parking lot. If the car is not in the parking lot, it should printCar not found in the parking lot
.spots_left()
method: returns an integer representing the number of available parking spots in the parking lot.
入力 | 出力 |
---|---|
| 2 |
| 1 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB