-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcard.py
More file actions
42 lines (30 loc) · 689 Bytes
/
card.py
File metadata and controls
42 lines (30 loc) · 689 Bytes
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
from functools import reduce
m=int(input())
r_s=[int(x) for x in input().split()]
N=int(input())
r_s=reduce(lambda x,y:x*y,r_s)
cards=[i for i in range(1,101)]
piles=[]
# def odeve(num,pno):
# if num%==0
#Rounds
for i in range(r_s,0,-1):
# lst=list(filter(lambda x:x%i==0,cards))
lst=[]
print(i)
for x in range(1,len(cards)+1):
if(x%i==0):
lst.append(cards[x-1])
# print(lst)
cards=[c for c in cards if c not in lst]
# print(cards)
piles.append(lst)
# print(piles)
# for i in piles:
# i.reverse()
cards=[]
for p in range(len(piles)-1,-1,-1):
cards=cards+piles[p]
print(cards)
print(cards[N-1])
# print(piles)