3452. 进制转换
摘要
Title: 3452. 进制转换
Tag: 进制转换
Memory Limit: 64 MB
Time Limit: 1000 ms
Powered by:NEFU AB-IN
3452. 进制转换
-
题意
写出一个程序,输入一个十六进制的数值字符串,输出该数值的十进制字符串。
-
思路
setbase: 设置流的数值底。用于表达式 out << setbase(base) 或 in >> setbase(base) 时,取决于 base 的值,更改流 out 或 in 的 basefield 标志
-
代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28/*
* @Author: NEFU AB-IN
* @Date: 2022-08-17 10:17:00
* @FilePath: \Acwing\3452\3452.cpp
* @LastEditTime: 2022-08-17 10:21:02
*/
using namespace std;
typedef pair<int, int> PII;
signed main()
{
IOS;
int x;
while (cin >> setbase(16) >> x)
{
cout << x << '\n';
}
return 0;
}