Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138478 黄枳润 R进制转十进制 C++ Accepted 0 MS 284 KB 636 2025-11-24 19:22:21

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int ans=0,r; char b[64]; cin>>r>>b; int len=strlen(b); for(int i=0,j=len-1;i<len&&j>=0;i++,j--){ switch(b[j]){ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':b[j]-=7; } ans+=((b[j]-'0')*pow(r,i)); } cout<<ans<<endl; return 0; }