文章
24
粉丝
0
获赞
254
访问
8.3k
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
int n;
string s;
while(cin >> n) {
int cnt = 0;
if(n == 0) {
cout << '0' << endl;
continue;
}
while(n > 0) {
int num = n % 2;
a[cnt ++] = num;
n /= 2;
}
for(int i = cnt - 1; i >= 0; i --) {
s += to_string(a[i]);
cout << s;
s.clear();
}
cout << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发