Update:修了一点排版,重新审核
分析:
首先,这题如果要长度最大,那么首项必然尽量小,即为x。
由于首项是x故每一项都是x的倍数,可以同除以x。
现在就是要求 中能有多少项。
接着暴力膜你每一项就行了······
上代码,Python3:
x,y=input().split();
k,w=int(y)//int(x),0
while 2**w<=k:w=w+1
print(w)Over,对于不想搞事的同志,到这里已经没了。
接着来一种高能玩玩······
自然语言编程
更详细的可以戳这里。
然后就是“自然语言”代码······
I have some long integers called x,y;
Let us begin;
Use the way of input(x,y);
I have some long integers called k(y divided by x),w(0),p(1);
While the value of p is less than the value of k plus 1 do{
Let the value of w be the value of w plus 1;
Let the value of p be the value of p times 2;
}
Print out w;
Print out '\n';
That is all;
Thank you so much;英语作文既视感。
代码前加上这些,语言选C++14就好了(滑稽。
真·Over.
祝大家切题愉快!