project
This commit is contained in:
29
24.7.py
29
24.7.py
@@ -25,8 +25,27 @@
|
||||
# a.append(i)
|
||||
# print(max([p1-p for p,p1 in zip(a, a[161:])]))
|
||||
|
||||
lst1 = [0, 1, 2, 3, 4, 5, 7, 8, 9, 10]
|
||||
# lst2 = [5, 3, 2, 0, 4, 1]
|
||||
# lst3 = ['нуль', 'один', 'два', 'три', 'четыре', 'пять']
|
||||
for a, b in zip(lst1,lst1[8:]):
|
||||
print(f'{a} {b}')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
f = open('24_7.txt').read().strip()
|
||||
cd = 0
|
||||
two = 0
|
||||
max_len = 0
|
||||
|
||||
for i in range(len(f)-1):
|
||||
if f[i] + f[i+1]== 'CD':
|
||||
cd += 1
|
||||
|
||||
while cd > 160:
|
||||
if f[two]=='C' and f[two+1] == 'D':
|
||||
cd -= 1
|
||||
two += 1
|
||||
|
||||
if cd == 160:
|
||||
max_len = max(max_len, i - two+2)
|
||||
|
||||
print(max_len)
|
||||
Reference in New Issue
Block a user