Files
python/TangDou/LuoGuBook/L19_2.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

23 lines
475 B
C++

#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
string str = "0123456789ABCDEF";
int main() {
//十六进制转十进制
int n = 114514;
//容器
vector<string> 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;
}