fork download
  1. t = int(input())
  2. for i in range(t):
  3. l = int(input())
  4. w_c = 2
  5. pkty = list(map(int, input().strip().split()))
  6. try:
  7. r = pkty[1] - pkty[0]
  8. for l in range(2, l, 1):
  9. if pkty[l] == pkty[l-1] + r:
  10. w_c += 1
  11. else:
  12. break
  13. # for k in range(w_c):
  14. # print(pkty[k], end=" ")
  15. print(w_c)
  16. except:
  17. print(l)
  18.  
  19.  
Runtime error #stdin #stdout #stderr 0.11s 23004KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
EOFError: EOF when reading a line