二进制数 题解:C++
#include <iostream>
#include <vector>
using namespace std;
int main()
{
auto n = 100000000;
while (cin >> n)
{
vector<int> r(0);
while (n)
{
r.push_back(n % 2);
n /= 2;
}
for (auto i = r.rbegin(); i != r.rend(); i++)
{
cout << *i;
}
cout << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发