You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
418 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int x = 255; // FF
vector<int> path; // 动态数组
while (x) {
int a = x % 16;
path.push_back(a);
x /= 16;
}
for (int i = path.size() - 1; i >= 0; i--) {
if (path[i] < 10)
cout << path[i];
else
printf("%c", 'A' + (path[i] - 10));
}
return 0;
}