Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
40996 张添杰 R进制转十进制 C++ Accepted 2 MS 276 KB 261 2022-10-23 10:55:28

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int x; string s; cin>>x>>s; int a=0; for(int i=0;i<s.size();i++){ if(s[i]>='0'&&s[i]<='9'){ a=a*x+s[i]-'0'; } else{ a=a*x+s[i]-'A'+10; } } cout<<a<<endl; return 0; }