#include <iostream>
#include <string.h>
using namespace std;
typedef long long ll;
ll getnum(char x){
if(x>='0'&&x<='9'){
return ll(x-'0');
}
else return ll(x-'A'+10);
}
ll g[8];
void getmypow(){
g[0]=1;
for(ll i=1; i<8; i++){
g[i]=g[i-1]*16;
}
}
int main()
{
string a;
cin>>a;
ll len=a.size();
ll num=0;
getmypow();
for(ll i=len-1; i>=0; i--){
num+=getnum(a[len-i-1])*g[i];
}
cout <<num<< endl;
return 0;
}
十六进制转十进制(蓝桥杯之前每日一题)
最新推荐文章于 2023-04-12 12:25:35 发布