1 条题解

  • 0

    #include<bits/stdc++.h>
    using namespace std;
    string s;
    int _8to10(string s);//声明
    string _10to16(int x);
    int main(){
    cin>>s;
    int n10=_8to10(s);
    cout<<_10to16(n10);
    return 0;
    }
    int _8to10(string s){//"765"
    int ans=0;
    for(int i=0;i<s.size();i++)
    ans=ans*8+s[i]-'0';
    return ans;
    }
    string _10to16(int x){
    if(x==0)return "0";
    string ret="";
    while(x!=0){
    if(x%16<10)ret=char(x%16+'0')+ret;
    else ret=char(x%16+'a'-10)+ret;
    x/=16;
    }
    return ret;
    }

  • 1

信息

ID
3116
难度
7
分类
(无)
标签
递交数
117
已通过
24
通过率
21%
上传者