-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path75.py
71 lines (63 loc) · 1.19 KB
/
75.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding:UTF-8 -*-
def factorial(n):
if n == 1:
return 1
elif n == 0:
return 1
elif n > 1:
return n*factorial(n-1)
else:
return 'error'
print factorial(100)
def deadline(a,b,c,y,m,d):
list =[31,28,31,30,31,30,31,31,30,31,30,31]
num = 0
if (y-a)>1:
for i in range(a+1,y):
if i % 4==0:
num+=1
num = num + (y-a-1)*365#num现在等于去掉头尾两年的总天数
if b == 12:
num = num + c
else:
for i in range(b,12):
num = num +list[i]
if (a%4==0) and (b<=2):
num+=1
num = num + list[b-1]-c
if m == 1:
num = num + d
else:
for i in range(m-1):
num = num +list[i]
if (y%4==0) and m>2:
num+=1
num = num + d
elif y == a:
if a%4==0 and b<=1:
num+=1
if b == m:
num = d-c
else:
for i in range(b,m-1):
num = num + list[i]
num = num + list[b-1] - c + d
elif y - a ==1:
if b == 12:
num = num + c
else:
for i in range(b,12):
num = num +list[i]
if (a%4==0) and (b<=2):
num+=1
num = num + list[b-1]-c
if m == 1:
num = num + d
else:
for i in range(m-1):
num = num +list[i]
if (y%4==0) and m>2:
num+=1
num = num + d
return num
print deadline(2000,1,1,2017,12,11)