文章

81

粉丝

2

获赞

494

访问

9.5k

头像
二进制数 题解:
P1380 北京邮电大学机试题
发布于2026年3月17日 17:12
阅读数 103

#include <iostream>
using namespace std;

int main(){
	int n;
	while(cin >> n){
		
		if(n==0){
			cout << 0 << endl;
			continue;
		}
		
		string s="";
		
		while(n>0){
			s = char(n%2 + '0') + s;
			n /=2;
		}
		
		cout << s << endl;
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发