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.
- Prepare
- Python
- Sets
- The Captain's Room
- Discussions
The Captain's Room
The Captain's Room
Sort by
recency
|
1554 Discussions
|
Please Login in order to post a comment
I couldn't help myself.
size=int(input()) Room_Number=list(map(int,input().split()))
captain = (sum(set(Room_Number)) * size - sum(Room_Number)) // (size - 1) print(captain)
solve it by using dict add the values and just call the value whose count is one thats the captain room
k = int(input()) rooms = list(map(int,input().split()))
dict1 = {}
for i in rooms: dict1[i]= dict1.get(i,0)+ 1
for keys,values in dict1.items(): if values == 1: print(keys)