scripts/ege/1.py
2023-05-05 00:45:01 +03:00

20 lines
461 B
Python
Vendored

with open("24.txt") as f:
data = f.read()
nx = [i for i in range(len(data)) if data[i] == "F"]
mx = 0
for bg in nx:
for eg in nx:
if eg > bg:
d = data[bg : eg + 1]
if d.count("A") <= 2:
if len(d) > mx:
mx = len(d)
else:
if bg % 1000 < 5:
print(f"broken, {bg}/{len(data)}, mx: {mx}")
break
print(mx)