Ad
Puzzles
Code
Diff
  • def satisfaction(participants, start_offset, tour_length):
        overlap = tour_length // start_offset
        firsts = overlap * ((overlap + 1) / 2)
        return participants * overlap - firsts
    • def satisfaction(n, x, t):
    • start_times = [i * x for i in range(n)]
    • finish_times = [(i * x) + t for i in range(n)]
    • upset_factor = 0
    • for i, writer in enumerate(finish_times):
    • for j, others in enumerate(start_times):
    • if others <= writer and i < j:
    • upset_factor += 1
    • print(start_times, finish_times)
    • return upset_factor
    • def satisfaction(participants, start_offset, tour_length):
    • overlap = tour_length // start_offset
    • firsts = overlap * ((overlap + 1) / 2)
    • return participants * overlap - firsts