题解 | #杨辉三角的变形#
杨辉三角的变形
http://www.nowcoder.com/practice/8ef655edf42d4e08b44be4d777edbf43
while True:
try:
n = int(input())
if n < 3:
print(-1)
continue
res, temp = [1, 1, 1], []
for _ in range(3, n+1):
res = [0] + res + [0]
i, Max = 0, len(res)
while i + 2 <= Max:
temp.append(sum(res[i:i+3]))
i += 1
res = [1] + temp + [1]
temp = []
for i, n in enumerate(res):
if n % 2 == 0:
print(i+1)
break
except:
break