文章

117

粉丝

69

获赞

866

访问

120.4k

头像
二进制数 (C++ 位运算)题解:
P1380 北京邮电大学机试题
发布于2024年4月24日 00:40
阅读数 648

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

int x;
string res;

int main()
{
	cin >> x;
	
	while(x)
	{
		res.push_back((x & 1) + '0');
		x >>= 1;
	}
	
	reverse(res.begin(), res.end());
	
	cout << res;
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发