按照进制转化的规则long long 数型存下即可
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <math.h>
using namespace std;
map<char,int> mp1;
void init(){
mp1['0']=0;
mp1['1']=1;
mp1['2']=2;
mp1['3']=3;
mp1['4']=4;
mp1['5']=5;
mp1['6']=6;
mp1['7']=7;
mp1['8']=8;
mp1['9']=9;
mp1['A']=10;
mp1['B']=11;
mp1['C']=12;
mp1['D']=13;
mp1['E']=14;
mp1['F']=15;
}
int main(){
string s;
init();
long long res=0;
cin >> s;
for(int i=s.length()-1;i>=0;i--){
res+=mp1[s[i]]*pow(16,s.length()-i-1);
}
cout << res;
}