#include <iostream> #include <string> #include <cctype> #include <cmath> using namespace std; // 输出描述有奇怪了 不是就输入一个 吗 为啥提到说用换行符隔开 int main() { long long ans; string d; // while (cin >> a >> b) { // 注意 while 处理多个 case // cout << a + b << endl; // } getline(cin, d); int l = d.size(); for(int i=l-1; i>=2; i--) { int s = l-1 - i; char ch = d[i]; // 字符转整型 long long chn; if(!isalpha(ch)) // 是数字 { chn = int(ch-'0'); // 坑在这里 字符到Int 这里不能 直接int() 那个是asicii2码 } else { ch = tolower(ch); chn = (ch - 'a')+10; // 类似的 相减 在传唤解码 } ans += chn*pow(16., s); } cout<<ans; } // 64 位输出请用 printf("%lld")