数组模拟实现。
class ParkingSystem {
public:
int pos[3];
ParkingSystem(int big, int medium, int small) {
pos[0] = big;
pos[1] = medium;
pos[2] = small;
}
bool addCar(int carType) {
return pos[carType - 1] -- > 0;
}
};