New Driver's License You have to get a new driver's license and you show up at the office at the same time as 4 other people. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

New Driver's License You have to get a new driver's license and you show up at the office at the same time as 4 other people.

name = input() agents = int(input()) clients = input() clients = clients.split() clients.append(name) clients.sort(reverse=True) time = 0 reminder = True while reminder: for i in range(agents): if clients[-1] == name: reminder = False break clients.pop() time += 1 print(time * 20)

21st Jun 2022, 11:01 AM
Ayush Tiwari
Ayush Tiwari - avatar
2 Respostas
+ 1
name = input() agents = int(input()) clients = input() clients = clients.split() clients.append(name) clients.sort(reverse=True) time = 0 reminder = True while reminder: for i in range(agents): if clients[-1] == name: reminder = False break clients.pop() time += 1 print(time * 20)
21st Jun 2022, 11:12 AM
Ayush Tiwari
Ayush Tiwari - avatar
+ 1
# Hi! If itā€™s just shorter code you want, you can compare with this one: name, agents, other = (input() for i in range(3)) print(20 * (1 + sorted(f"{name} {other}".split()).index(name)//int(agents)))
24th Jun 2022, 10:29 AM
Per Bratthammar
Per Bratthammar - avatar