+ 1
26th Feb 2020, 8:09 PM
Arthur Barbosa
Arthur Barbosa - avatar
4 Answers
+ 2
Michael 2 Anna John Nancy Vera output: 20 expected output: 40
27th Feb 2020, 12:05 AM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Arthur Barbosa in the example with the input from Denise's example: Michael 2 Anna John Nancy Vera After sorting you calculate your position to be 3 and then multiply by 20. This is 60. Then you subtract agents (2) * 20 which is 40. 60-40=20 which is not correct. Position 3 should be 40. Two people , 2 agents is 20 minutes. Then your next for 20 minutes. So that's 40.
27th Feb 2020, 1:37 AM
Paul K Sadler
Paul K Sadler - avatar
+ 1
Thank you everybody!! I changed my code, now is working perfectly!
28th Feb 2020, 12:44 AM
Arthur Barbosa
Arthur Barbosa - avatar
0
myname = input() num_agents = int(input()) other_names = list(input().split()) other_names.append(myname) other_names.sort() ind_myname = other_names.index(myname)+1 print('20' if ind_myname <=num_agents else (ind_myname-num_agents)*20+20)
25th Nov 2021, 10:29 PM
Mas'ud Saleh
Mas'ud Saleh - avatar