jrldc 发表于 2015-11-11 18:02:09

https://codility.com/programmers/task/fish


def fish(A,B):
    if sum(B)==0 or sum(B)==len(B):
      return len(B)   
    else:
      pos = B.index(1)
      for P in range(len(A)):
            if pos < P and B==0 and A > A:
                A=0
            if pos < P and B==0 and A < A:
                A=0
    list=[]   
    for i in A:
      if i !=0:
            list.append(i)
    returnlen(list)
页: [1]
查看完整版本: https://codility.com/programmers/task/fish