题解 | #计算日期到天数转换#
计算日期到天数转换
http://www.nowcoder.com/practice/769d45d455fe40b385ba32f97e7bcded
ys,ms,ds=input().split()
y=int(ys)
m=int(ms)
d=int(ds)
if y%100!=0 and y%4==0:
if m==1:
print(d)
elif m==2:
print(31+d)
elif m==3:
print(31+29+d)
elif m==4:
print(31+29+31+d)
elif m==5:
print(31+29+31+30+d)
elif m==6:
print(31+29+31+30+31+d)
elif m==7:
print(31+29+31+30+31+30+d)
elif m==8:
print(31+29+31+30+31++30+31+d)
elif m==9:
print(31+29+31+30+31++30+31+31+d)
elif m==10:
print(31+29+31+30+31++30+31+31+30+d)
elif m==11:
print(31+29+31+30+31++30+31+31+30+31+d)
else:
print(31+29+31+30+31++30+31+31+30+31+30+d)
elif y%100==0 and y%400==0:
if m==1:
print(d)
elif m==2:
print(31+d)
elif m==3:
print(31+29+d)
elif m==4:
print(31+29+31+d)
elif m==5:
print(31+29+31+30+d)
elif m==6:
print(31+29+31+30+31+d)
elif m==7:
print(31+29+31+30+31+30+d)
elif m==8:
print(31+29+31+30+31++30+31+d)
elif m==9:
print(31+29+31+30+31++30+31+31+d)
elif m==10:
print(31+29+31+30+31++30+31+31+30+d)
elif m==11:
print(31+29+31+30+31++30+31+31+30+31+d)
else:
print(31+29+31+30+31++30+31+31+30+31+30+d)
else:
if m==1:
print(d)
elif m==2:
print(31+d)
elif m==3:
print(31+28+d)
elif m==4:
print(31+28+31+d)
elif m==5:
print(31+28+31+30+d)
elif m==6:
print(31+28+31+30+31+d)
elif m==7:
print(31+28+31+30+31+30+d)
elif m==8:
print(31+28+31+30+31++30+31+d)
elif m==9:
print(31+28+31+30+31++30+31+31+d)
elif m==10:
print(31+28+31+30+31++30+31+31+30+d)
elif m==11:
print(31+28+31+30+31++30+31+31+30+31+d)
else:
print(31+28+31+30+31++30+31+31+30+31+30+d)
#最笨的方法,做完看其他人的解题策略,才知道我的又多笨...