文章

43

粉丝

24

获赞

281

访问

6.3k

头像
进制转换2 题解:very good
P1259 北京大学机试题
发布于2025年3月11日 20:42
阅读数 32

#include <bits/stdc++.h>  
using namespace std;
int main(){  
    string s;
    while(cin>>s){
        int ans=0;
        for(int i=2;i<s.size();i++){
            ans*=16;
            if(s[i]>='A'&&s[i]<='F'){
                ans+=s[i]-'A'+10;
            }
            else{
                ans+=s[i]-'0';
            }
        }
        cout<<ans<<endl;
    }
    
&nbs...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发