1 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main() { int x; string s; cin>>x>>s; reverse(s.begin(),s.end()); //翻转整个字符串 int p=1; //第i个位置上的权重 int res=0; for(int i=0;i<s.size();i++) { int t; //计算当前位表示的数 if(s[i]>='A'&&s[i]<='Z') { t=s[i]-'A'+10; } else { t=s[i]-'0'; } res=res+t*p; p=p*x; } cout<<res; return 0; }
- 1
Information
- ID
- 1194
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- (None)
- # Submissions
- 5
- Accepted
- 3
- Uploaded By