文章

2

粉丝

0

获赞

2

访问

210

头像
十进制转二进制 题解:
P1715 兰州大学/西北工业大学机试题
发布于2025年3月21日 12:27
阅读数 37

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int x;
    int index=0;
    while(cin>>x){
        bitset<64> bs(x);
        string str=bs.to_string();
        index=str.find_first_of('1');//从左往右
        string str1=str.substr(index);
        cout<<str1<<endl;
    }
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发