#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(){
string str;
while(cin>>str){
int n = str.size();
// cout<<str<<endl;
int num = 0;
for(int i=2;i<n;i++){
// cout<<"now is "<<str[i]<<endl;
int tmp = 0;
if('0'<=str[i]&& str[i]<='9'){
tmp = str[i] - '0';
// cout<<"among 0---9"<<endl;
}
else if('A'<=str[i]&& str[i]<='F'){
tmp = str[i] - 'A' + 10;
// cout<<"among A--F"<<endl;
}
else if('a'<=str[i]&& str[i]<='f'){
tmp = str[i] - 'a' + 10;
// cout<<"among A--F"<<endl;
}
// int tmp = str[i] - 'a';
num *= 16;
num += tmp;
}
cout<<num<<endl;
}
return 0;
}
牛客真题_2017hw_16转10进制
最新推荐文章于 2024-05-06 14:56:36 发布