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.
23 lines
475 B
23 lines
475 B
2 years ago
|
#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;
|
||
|
}
|