n=int(input())
a=1;q=[0]*100;two=three=rear=0;q[0]=a
while rear!=n:
if(2*q[two]+1>3*q[three]+1):
rear+=1
q[rear]=3*q[three]+1
three+=1
elif(2*q[two]+1<3*q[three]+1):
rear+=1
q[rear]=2*q[two]+1
two+=1
else:
rear+=1
q[rear]=3*q[three]+1
two+=1;three+=1
运行上述程序段后,如果输入10,则q[n]的值是( )
A.15 | B.22 | C.27 | D.31 |

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

