This commit is contained in:
BarsTiger
2021-10-15 12:46:53 +03:00
parent b9772007b3
commit 68fb5410ee
45 changed files with 729 additions and 16 deletions

View File

@@ -0,0 +1,25 @@
import copy
import itertools
max = 0
ostatki = []
n = int(input())
chisla = map(int, input().split())
oldallresults = []
somechisl = ""
for i in range(1, n + 1):
newlist = copy.deepcopy(chisla)
result = itertools.combinations(newlist, i)
oldallresults.extend(result)
for i in range(len(oldallresults)):
for j in oldallresults[i]:
somechisl = str(somechisl) + str(j)
intsomechisl = int(somechisl)
if intsomechisl % 15 == 0 and intsomechisl > max:
max = intsomechisl
somechisl = ""
if max != 0:
print(max)
else:
print("Impossible")