TOPIC
Runtime error No module named numpy
vtanoshi asked 3 years ago
import numpy
N = int(input())
arr = [0]*N
for x in range (0,N):
arr[x] = int(input())
arr = numpy.sort(arr)
ver = 1;
for x in range (0,N):
if x != N-1 and arr[x] == arr[x+1]:
ver = ver + 1
if (x != N-1 and(arr[x] != arr[x+1])) or x == N-1:
print ("%d aparece %d vez(es)" %(arr[x],ver))
ver = 1
Run time error, se eu substituir "arr=numpy.sort()" por:
temp = 0
for j in range (0,N):
for k in range (j+1,N):
if (arr[j]>arr[k]):
temp = arr[j]
arr[j] = arr[k]
arr[k] = temp
Acontece time limit exceeded, provavelmente por causa da quantidade de Loops no programa
Alguem teria alguma dica?