Created
May 24, 2019 01:50
-
-
Save lucas404x/ba6e3247dba4b31267ce9f9f46a8aa66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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