Advertisement
gustbs

Ultima tentativa

Mar 12th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. for case in range(64):
  2.     number_of_marbles, number_of_queries = map(int, input().split()) # Recebe número de mármores e pesquisas
  3.  
  4.     if number_of_marbles == 0 and number_of_queries == 0: # Termina o jogo se for 0 mármores e 0 pesquisas
  5.         break
  6.    
  7.     marbles = [int(input()) for time in range(number_of_marbles)] # Usuário digita os mármores numerados
  8.     marbles.sort() # Organiza os mármores em ordem crescente
  9.  
  10.     queries = [int(input()) for time2 in range(number_of_queries)] # Usuário digita o mármore que quer pesquisar
  11.    
  12.     print("CASE# {}:".format(case + 1))
  13.     for query in queries:
  14.         if query in marbles:
  15.             print("{0} found at {1}".format(query, marbles.index(query) + 1)) # Busca a pesquisa do usuário em marbles
  16.         else:
  17.             print("{} not found".format(query)) # Retorna "not found" caso a pesquisa não seja encontrada.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement