question: Cards Game
There are M people from 1 to M . Andy has N cards with her. Starting with person Z , he gives the cards one by one to the people in the numbering order. Z, Z+1, Z+2,.....,M, 1, 2,....Z-1. Your task is to output the number of the person who will get the last card.
input 1:- 3 3 2
output 1:- 1
input 2 :- 1 100 1
output 2:- 1
def dist_card(M, N, Z):
list1 = []
for i in range(1, M + 1):
list1.append(i)
print(list1[Z + N])
Comments
Leave a comment