-
-
Save hUwUtao/b0f30d770d336ce34f8d3d8e792160a5 to your computer and use it in GitHub Desktop.
cp 101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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