1

mail@pastecode.io avatar
unknown
python
a year ago
328 B
2
Indexable
Never
def max_seq_len(arr):
    n = len(arr)
    dp = [1] * n

    for i in range(1, n):
        for j in range(i):
            if arr[i] == 2 * arr[j]:
                dp[i] = max(dp[i], dp[j] + 1)

    return max(dp)


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