#include<bits/stdc++.h> using namespace std; int n; string a; int b[10010]; int main() { cin>>n>>a; for(int i=0;i<a.size();i++) { if(a[i]>='0'&&a[i]<='9') b[i]=a[i]-'0'; else b[i]=a[i]-'A'+10; } int power=0,res=0; for(int i=a.size()-1;i>=0;i--) { res+=b[i]*round(pow(n,power)); power++; } cout<<res; return 0; }标签:std,10,进制,power,int,10010 From: https://www.cnblogs.com/wqy2003/p/16906749.html