设计题
class ParkingSystem {
public:
ParkingSystem(int big, int medium, int small) {
this->big = big;
this->medium = medium;
this->small = small;
}
bool addCar(int carType) {
switch (carType) {
case 1:
if (!big) return false;
--big;
break;
case 2:
if (!medium) return false;
--medium;
break;
case 3:
if (!small) return false;
--small;
break;
}
return true;
}
private:
int big, medium, small;
}