Skip to content

Instantly share code, notes, and snippets.

@hUwUtao
Last active March 1, 2024 10:12
Show Gist options
  • Save hUwUtao/b0f30d770d336ce34f8d3d8e792160a5 to your computer and use it in GitHub Desktop.
Save hUwUtao/b0f30d770d336ce34f8d3d8e792160a5 to your computer and use it in GitHub Desktop.
cp 101
def main():
fs = open("flowers.inp", "r")
n = int(fs.readline())
a = list(map(int, fs.readline().split(" ")))
for i, c in enumerate(a[:-3]):
if c == a[i+1] == a[i+2] and c != a[i+3]:
print(n - i -1)
return
print(n)
main()
def main():
fs=open("DOANCON2.py", "r")
n=int(fs.readline())
a=map(int,fs.readline().split(" "))
ls=a[0]>0
th=0
bth=0
for i,a in enumerate(list(a)[:-2]):
if a>0 != ls:
ls = a>0
th+=1
elif th > bth:
bth = th
th = 0
print(bth)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment