京东编程题站队
#python代码如下,用l记录第一个没被判断是否为小偷的下标。只能通过70%求解。。。 n = int(raw_input())
queue = list(raw_input())
if len(queue)!=n:
exit()
count = 0
i=0
l=0
while i < n and l < n:
if queue[i] in '123456789':
#police
low = max(l, i-int(queue[i]))
high = min(n-1, i+int(queue[i]))
if low<=high:
for k in queue[low:high+1]:
if k == 'X':
count += 1
l = high+1
i+=1
print count