計蒜客:百度的年會遊戲

 只經過第一組測試點,待研究python

#coding=utf-8
s = tuple([int(c) for c in raw_input().split()])
num1,num2,num3,num4 = s
k,d = tuple([int(c) for c in raw_input().split()])
#print num1,num2,num3,num4
total = []

def get_list(n):
	return [0 for i in range(n)]
#print get_list(5)
for item in s:
	total.append(get_list(item))
total[k-1][-d-1:-d+1] = [1,1]
#print total
number = 0
for x in range(1,7):
	for y in range(x,7):
		totate = x+y
		smaller = min(x,y)
		kk = totate % 4
		new = total[kk][:-smaller+1]
		new1 = new[::-1]
		for i in range(3):
			kk -= 1
			new1 += total[kk][::-1]
		if new1[:2] == [1,1] or new1[8:10] == [1,1] or new1[17:19] == [1,1]:
			number += 1
print number
相關文章
相關標籤/搜索