题解 | #进制转换#
进制转换
https://www.nowcoder.com/practice/deb19498bc644f53a6a99905ef5ee01d
#include <iostream>
using namespace std;
int CharToInt(char c){
if(c >= '0' && c <= '9') return c - '0';
else return c - 'A' + 10;
}
int main() {
string str;
while (cin >> str) {
int x = 0;
for(int i = 2; i < str.length(); i ++){
x = x * 16 + CharToInt(str[i]);
}
cout << x << endl;
}
return 0;
}

