We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
We simply calculate the difference in what the sum would be if there were K elements of all groups. We will have k-1*captains room number left, we simply didve by k-1 to get the answer.
The Captain's Room
You are viewing a single comment's thread. Return to all comments →
Python 3
k,arr = int(input()),list(map(int, input().split()))
myset = set(arr)
print(((sum(myset)*k)-(sum(arr)))//(k-1))
We simply calculate the difference in what the sum would be if there were K elements of all groups. We will have k-1*captains room number left, we simply didve by k-1 to get the answer.