题解 | #小q的数列#
小q的数列
http://www.nowcoder.com/practice/76796815518f4db5b800775581cda1e4
逻辑应该是对的,但是python运行时间超出限制。
t=int(input())
while True:
try:
x=int(input())
f=[0,1]
i=2
while i<=x:
f.append(f[i//2]+f[i%2])
i+=1
lis=[]
for j in range(len(f)):
if f[j]==f[x]:
lis.append(j)
print(str(f[x])+' '+str(lis[0]))
except:
break