26(13) РТ
user_8840555
python
2 years ago
471 B
4
Indexable
f = open(r'C:\Users\SnowDrit\Downloads\26(1)\26.13.txt') # на 1 и 2 балл n = f.readline() korobki = [] for s in f: korobki.append(int(s)) korobki.sort(reverse = True) bloks = [] while len(korobki) != 0: podarok = [max(korobki)] for korobka in korobki[1:]: if podarok[-1] - korobka >= 7: podarok.append(korobka) bloks.append(podarok) for x in podarok: korobki.remove(x) print(len(bloks),len(bloks[0]))
Editor is loading...