已知2011年11月11日是星期五,问YYYY年MM月DD日是星期几? 注意考虑闰年的情况。尤其是逢百年不闰,逢400年闰的情况。输入格式 输入只有一行 YYYY MM DD输出格式 输出只有一行 W数据规模和约定 1599 1 1 1 样例输入2011 11 11样例输出5Python示例(输入必须为真实存在且和为题目要求相一致的输入,例如1111年11月11日和2011年2月30日就不能作为输入,类似边界条件待补充)a = "2011 11 11"def ifRunNian(y1): y = int(y1) if y >= 1599 and y if y%4==0 : if y%100==0: if y%400==0: return 366 else: return 365 else: return 366 else: return 365 else: return -1def month2day(y1, m1): m = int(m1) yb = ifRunNian(y1) if m = 1: if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12: return 31 elif m == 4 or m == 6 or m == 9 or m == 11: return 30 elif m == 2: if yb == 366: return 29 elif yb == 365: return 28 print(m)def getDeltaYear(y1): y = int(y1) deltaYList = [] if y for i in range(2011-y): deltaYList.append(y+i) elif y>=2011 and y for i in range(y-2011): deltaYList.append(2011+i) return tuple(deltaYList)def getDeltaDay(y1, m1, d1): deltaAllDay = 0 y = int(y1) m = int(m1) d = int(d1) deltaMList = [] dy = getDeltaYear(y1) if y if dy != (): for i in dy: if i == dy[0]: for j in range(m, 13): # print(int(j)) md = month2day(i, j) deltaAllDay += md deltaAllDay -= d else: deltaAllDay += ifRunNian(i) for j in range(1, 11): deltaAllDay += month2day(int(i)+1, j) deltaAllDay += 11 else: i = 2011 for j in range(m, 11): md = month2day(i, j) deltaAllDay += md deltaAllDay -= d deltaAllDay += 11 deltaAllDay = -deltaAllDay # elif y elif y > 2011 or (y == 2011 and m > 11) or (y == 2011 and m == 11 and d > 11): if dy != (): print(dy) for i in dy: if i == dy[0]: for j in range(11, 13): deltaAllDay += month2day(i, j) deltaAllDay -= 11 else: deltaAllDay += ifRunNian(i) for j in range(1, m): deltaAllDay += month2day(int(i)+1, j) deltaAllDay += d else: i = 2011 for j in range(11, m): md = month2day(i, j) deltaAllDay += md deltaAllDay -= 11 deltaAllDay += d return deltaAllDaydef day2week(deltaAllDay): if deltaAllDay deltaAllDay = - deltaAllDay e = 5- deltaAllDay % 7 print(e) while e e += 7 while e > 7: e -= 7 print(f'星期{e}') else: e = 5 + deltaAllDay % 7 while e e += 7 while e > 7: e -= 7 print(f'星期{e}')print(a)ymd = a.split(" ")y, m, d = (ymd[0], ymd[1], ymd[2])print(f'{y}, {m}, {d}')# day2week(y, m, d)k = getDeltaDay(1949, 10, 1)print(k)day2week(k)print(month2day(2012, 2))