文章

76

粉丝

0

获赞

316

访问

15.4k

头像
二进制数 题解:
P1380 北京邮电大学机试题
发布于2026年2月1日 10:13
阅读数 191

#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

void change(int x) {
	vector<int> q;
	while (x) {
		q.push_back(x % 2);
		x /= 2;
	}
	reverse(q.begin(),q.end());
	for (auto c : q) cout << c;
	cout << endl;
}

int main() {
	int x;
	cin >> x;
	change(x);
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发