# coding: utf-8
N = raw_input()
R = raw_input()
X = raw_input()
N, R, X = map(int, N.split())[0],map(int, R.split())[0],map(int, X.split())
colored_pos = [X[0]]
pos = X[0]
# print X
while(1):
far = pos
for (i,x) in enumerate(X):
if pos + R > x:
far = x
else:
break
colored_pos.append(far)
pos = x
if pos + x > X[-1]:
break
print colored_pos
Ich habe split () gelernt.
Recommended Posts