1
This commit is contained in:
25
levieProekti/Olymp2020/gorodolymp2tour14,12,2020/15++.py
Normal file
25
levieProekti/Olymp2020/gorodolymp2tour14,12,2020/15++.py
Normal 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")
|
||||
Reference in New Issue
Block a user