18 lines
418 B
C++
18 lines
418 B
C++
#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;
|
|
} |