repl.it
@peachyog/

Max and Cards

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import itertools


n = int(input())
q = int(input())

lst = []
perms = []
outputIndexes = []



def permutations(elements):
  perms = []
  allPerms = []
  for i in range(n):
    if i <= factorial(n): 
      allPerms.append(itertools.permutations(elements[i:]))
  if len(elements) <= 1:
    yield elements
  else:
    
def factorial(n):
  for i in range(1,n,-1):
    n*=i
  return n
    
"""
for i in range(n):
  lst.append(i+1)

for permutation in itertools.permutations(lst):
  perms.append(permutation)

for i in range(q):
  outputIndexes.append(int(input()))

for i in range(len(outputIndexes)):
  print(perms[outputIndexes[i]])
"""
Fetching token
?