Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (15 sloc) 300 Bytes
rooms = 500
employees = 500
# The first employee opens all the doors
doors = [1 for i in range(0,rooms)]
for i in range(1, employees):
j = i
step = i + 1
while (j < 500):
if (doors[j] == 0):
doors[j] = 1
else:
doors[j] = 0
j += step
print(doors)
print(sum(doors))
You can’t perform that action at this time.