#include<iostream>
#include<ctype.h>
#include<math.h>
using namespace std;
int main(int argc, char **argv) {
string str;
cin>>str;
string::iterator p=str.end();
p--;
int x=0;
long long sum=0;
int t;
while(p>=str.begin()){
if(isalpha(*p))
t=*p-'A'+10;
else
t=*p-'0';
sum+=t*pow(16,x++);
p--;
}
cout<<sum<<endl;
return 0;
}
蓝桥杯 十六进制转十进制
最新推荐文章于 2022-01-11 09:52:10 发布