【python】蔡勒公式计算日期

import math
def Zeller(year,m,d):
    if(m==1):
        m = 13
        year = year-1
    if(m==2):
        m = 14
        year = year -1
    c= year / 100
    y = year % 100
    w = math.ceil((y+int(y/4)+int(c/4)-2*c+(26*(m+1)/10)+d+700-1)%7)
    return w
dict = {1: "星期一", 2: "星期二", 3: "星期三", 4: "星期四", 5: "星期五", 6: "星期六", 0: "星期天"}
year = eval(input("请输入年份:"))
m = eval(input("请输入月份:"))
d = eval(input("请输入日期数:"))
w = Zeller(year,m,d)
print(dict.get(w))
上一篇:Python小练习


下一篇:大视野 1016: [JSOI2008]最小生成树计数(最小生成树)