Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
163215 王丞杰 R进制转十进制 C++ Accepted 1 MS 280 KB 316 2026-10-24 15:56:46

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int r,k=0,sum=0; string s; cin>>r>>s; int lens=s.size(); for(int i=lens-1;i>=0;i--){ if('0'<=s[i]&&s[i]<='9'){ sum+=(s[i]-'0')*pow(r,k); } else if(s[i]>='A'){ sum+=(s[i]-55)*pow(r,k); } k++; } cout<<sum; return 0; }