解题思路:
注意事项:
参考代码:
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 人评分