解题思路:
注意事项:
参考代码:
def f(year1):
if (year1 % 100 != 0 and year1 % 4 == 0) or year1 % 400 == 0:
return 1
else:
return 0
results = []
month_r = {1: 31, 2: 29, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}
month_p = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}
month_ = list()
month_.append(month_p)
month_.append(month_r)
while True:
over_days = 10000
try:
year, month, day = map(int, input().split())
except:
break
else:
if f(year) == 1:
for m in range(month+1, 13):
over_days -= month_r[m]
over_days -= (month_r[month] - day)
else:
for m in range(month+1, 13):
over_days -= month_p[m]
over_days -= (month_p[month] - day)
year += 1
month = 1
day = 1
while over_days > 365 + f(year):
over_days -= 365 + f(year)
year += 1
for moo in range(1, 13):
if over_days > month_[f(year)][moo]:
over_days -= month_[f(year)][moo]
else:
month = moo
break
results.append(f"{year}-{month}-{over_days}")
for result in results:
print(result)
0.0分
0 人评分
C语言网提供由在职研发工程师或ACM蓝桥杯竞赛优秀选手录制的视频教程,并配有习题和答疑,点击了解:
一点编程也不会写的:零基础C语言学练课程
解决困扰你多年的C语言疑难杂症特性的C语言进阶课程
从零到写出一个爬虫的Python编程课程
只会语法写不出代码?手把手带你写100个编程真题的编程百练课程
信息学奥赛或C++选手的 必学C++课程
蓝桥杯ACM、信息学奥赛的必学课程:算法竞赛课入门课程
手把手讲解近五年真题的蓝桥杯辅导课程
发表评论 取消回复