文章

49

粉丝

49

获赞

8

访问

11.5k

头像
二进制数 题解:C++
P1380 北京邮电大学机试题
发布于2024年3月14日 21:24
阅读数 163

#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;
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发