文章

285

粉丝

20

获赞

876

访问

202.6k

头像
进制转换 题解:
P1178 北京大学上机题
发布于2026年3月28日 18:27
阅读数 222

#include<bits/stdc++.h>
using namespace std;
bool isZero(string s){
    for(char c:s){
        if(c!='0')return false;
    }
    return true;
}
int main(){
    string s;
    while(cin>>s){
        if(isZero(s)) {cout<<'0'<<endl;continue;}
        string rel="";
        while(!isZero(s)){
            rel+=(s.back()-'0')%2+'0';
            int carry=0;
            for(int i=0;i<s.size();i++){
                int c=s[i]-'0'+carry*10;
                s...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发