Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
41001 王锐 R进制转十进制 C++ Accepted 1 MS 276 KB 259 2022-10-23 10:58:07

Tests(10/10):


Code:

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