本质:层序——队列
#include<bits/stdc++.h>
using namespace std;
int main(){
int m,n;
queue<int> q;
int sum;
while(scanf("%d %d",&m,&n)!=EOF){
sum = 0;
q.push(m);
while(!q.empty()){
int tmp = q.front();
sum++;
q.pop();
if(2*tmp<=n)
q.push(2*tmp);
if(2*tmp+1<=n)
q.push(2*tmp+1);
}
&nbs...
登录后发布评论
暂无评论,来抢沙发