题解 | #进制转换#
进制转换
https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
#include <iostream> using namespace std; int main() { const string hexdigits = "0123456789ABCDEF"; string s; cin >> s; unsigned u = 0; for (string::size_type i = 2; i != s.size(); ++i) { auto result = hexdigits.find(s[i]); u = u * 16 + result; } cout << u << endl; return 0; } // 64 位输出请用 printf("%lld")