知道某一天的日期和星期几,计算第n天后的日期以及是星期几
weekname = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saterday", "Sunday"] normal_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] special_month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def judge_year(year: int) -> int: if year % 400 == 0: return 366 if year % 100 == 0: return 365 if year % 4 == 0: return 366 else: return 365 def judge_month_day(days: int, month_list: list) -> str: for i in range(len(month_list)): if days > month_list[i]: days -= month_list[i] else: return "{}/{}".format(i+1, days) def func(): # please define the python3 input here. # For example: a,b = map(int, input().strip().split()) n = int(input().strip()) # please finish the function body here. days = n + 1 cur_month_day = "" cur_year = 2000 while True: year_days = judge_year(cur_year) if days <= year_days: if year_days == 365: cur_month_day = judge_month_day(days, normal_month) else: cur_month_day = judge_month_day(days, special_month) break cur_year += 1 days -= year_days weekday = weekname[(n + 5) % 7] # please define the python3 output here. For example: print(). print("{}/{} {}".format(cur_year, cur_month_day, weekday)) if __name__ == "__main__": func()