'commit'
This commit is contained in:
23
TangDou/LuoGuBook/L19_2.cpp
Normal file
23
TangDou/LuoGuBook/L19_2.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user