-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNo_1603.cs
47 lines (44 loc) · 1.08 KB
/
No_1603.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace LeetCode
{
/// <summary>
/// Problema No 1603
/// </summary>
public class ParkingSystem
{
int _big = 0, _medium = 0, _small = 0;
public ParkingSystem(int big, int medium, int small)
{
this._big = big;
this._medium = medium;
this._small = small;
}
public bool AddCar(int carType)
{
switch (carType)
{
case 1:
if (_big > 0)
{
_big--;
return true;
}
break;
case 2:
if (_medium > 0)
{
_medium--;
return true;
}
break;
case 3:
if (_small > 0)
{
_small--;
return true;
}
break;
}
return false;
}
}
}