Untitled

mail@pastecode.io avatar
unknown
python
a year ago
290 B
2
Indexable
Never
def max_seq_len(arr):
    n = len(arr)
    dp = [[0]] * n
    for i in range(n - 1):
        if arr[i] * 2 == arr[i+1]:
            dp[i].append(arr[i])
    return len(dp[0])


num = int(input())
nums = []
while num != 0:
    nums.append(num)
    num = int(input())
print(max_seq_len(nums))