#include using namespace std; const int INF = 0x3f3f3f3f; typedef long long LL; string str = "0123456789ABCDEF"; int main() { //十六进制转十进制 int n = 114514; //容器 vector v; //类似于数位分离 while (n) { int a = n % 16; v.push_back(str.substr(a, 1)); n /= 16; } //反着输出 for (int i = v.size() - 1; i >= 0; i--) cout << v[i]; return 0; }