Skip to content

Instantly share code, notes, and snippets.

@lucas404x
Created May 24, 2019 01:50
Show Gist options
  • Save lucas404x/ba6e3247dba4b31267ce9f9f46a8aa66 to your computer and use it in GitHub Desktop.
Save lucas404x/ba6e3247dba4b31267ce9f9f46a8aa66 to your computer and use it in GitHub Desktop.
def fatorial(n):
fat = 1
for i in range(n):
fat *= (n - i)
return fat
def decremento(n):
newNumber = ""
for i in range(n):
newNumber += str(n - i)
return newNumber
def permutacao(n):
import random
perm = []
while len(perm) != fatorial(len(n)):
permutacao = "".join(random.sample(n, len(n)))
if not permutacao in perm:
perm.append(permutacao)
return perm
n = permutacao(decremento(int(input())))
numbers = []
for i in range(len(n) - 1):
numbers.append(input())
for number in n:
if not number in numbers:
print(number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment