Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
126446 涛涛老师 R进制转十进制 C++ Accepted 1 MS 276 KB 486 2025-07-19 10:23:57

Tests(10/10):


Code:

#include <iostream> #include <vector> #include <math.h> using namespace std; void arbitrary(int n, string sample) { int sum = 0; int temp; for (int i = 0; i < sample.length(); i++) { if (sample[i] >= 'A') temp = (sample[i] - 'A'+10) * pow(n, sample.length()-i-1); else temp = (sample[i] - '0') * pow(n, sample.length() - i - 1); sum += temp; } cout << sum; } int main() { int n; string str; cin >> n >> str; arbitrary(n, str); return 0; }