2013-04-17 14:34:39 +08:00

34 lines
528 B
Python

month = (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
def testyear(x):
if x % 400 == 0:
return True
if x % 100 != 0 and x % 4 == 0:
return True
return False
pair = [[1900, 1], 1]
def next():
pair[1] += month[pair[0][1]]
if testyear(pair[0][0]) and pair[0][1] == 2:
pair[1] += 1
pair[1] %= 7
pair[0][1] += 1
if pair[0][1] > 12:
pair[0][1] = 1
pair[0][0] += 1
total = 0
for i in xrange(12):
next()
while pair[0][0] < 2001:
if pair[1] == 0:
total += 1
next()
print total