更新 README,增加 t10

This commit is contained in:
Luthics 2022-10-20 21:43:21 +08:00
parent a1ced46784
commit a273b013ab
2 changed files with 24 additions and 1 deletions

View File

@ -1,2 +1,7 @@
# XJTU-Python
西交大 Python 相关资源
### 一些自学可以参考的资源
[菜鸟教程](https://www.runoob.com/python3/python3-tutorial.html)
[GitHub:Python - 100天从新手到大师](https://github.com/jackfrued/Python-100-Days)

18
homework/2/10.py Normal file
View File

@ -0,0 +1,18 @@
def run(year):
if (year % 400 == 0):
return True
elif (year % 100 == 0):
return False
elif (year % 4 == 0):
return True
else:
return False
ms = [0, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
y, m, d = map(int, input().split())
ms[2] = 29 if run(y) else 28
ans = 0
for i in range(1, m):
ans += ms[i]
print(ans+d)