You are viewing a single comment's thread. Return to all comments →
def get_sum(s, c, k, t): v = None for p in range(s, len(c), 2 * k + 1): print(p, end=' ') if v: t += 2 * k + 1 else: v = 0 v += c[p] if t < len(c): v = None print(' => ', v, 't=', t) return v def turnOffTheLights(k, c): mm = None for s in range(k + 1): summ = get_sum(s, c, k, k + 1 + s) if not mm or (summ and mm > summ): mm = summ return mm
Seems like cookies are disabled on this browser, please enable them to open this website
Turn Off the Lights
You are viewing a single comment's thread. Return to all comments →