十六进制转十进制
#include <iostream>
#include <string>
using namespace std;
int main() {
string c;
while (cin >> c) {
int sum = 0, t = 1;
for (int i = c.size() - 1; i >= 2; i--) {
int a = c[i] >= 'A' ? c[i] - 'A' + 10 : c[i] - '0';
sum += a * t;
t *= 16;
}
cout << sum<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发