文章

74

粉丝

0

获赞

98

访问

9.0k

头像
二叉树2 题解:
P1264 北京大学机试题
发布于2025年8月13日 18:17
阅读数 95

#include<bits/stdc++.h>
using namespace std;

void getNum(int m, int n, int &cnt){
	if(m <= n){
		cnt ++;
		getNum(m * 2, n, cnt);
		getNum(m * 2 + 1, n, cnt);
	}
}

int main(){
	
	int m, n;
	while(cin >> m >> n){
		int cnt = 0;
		getNum(m, n, cnt);
		cout << cnt << endl;
	}
	
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发