-
-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy path1118.py
More file actions
16 lines (15 loc) · 582 Bytes
/
1118.py
File metadata and controls
16 lines (15 loc) · 582 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
__________________________________________________________________________________________________
class Solution:
def numberOfDays(self, y: int, m: int) -> int:
add=0
if y%400==0:
add=1
elif y%4==0 and y%100!=0:
add=1
if m==2:
return 28+add
if m<=7:
return 30+(m%2)
return 31-(m%2)
__________________________________________________________________________________________________
__________________________________________________________________________________________________