You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include<bits/stdc++.h>
|
|
|
|
|
using namespace std;
|
|
|
|
|
int main() {
|
|
|
|
|
string s;
|
|
|
|
|
int i=0,count,sum;
|
|
|
|
|
while(getline(cin,s)) {
|
|
|
|
|
int count=s.length();
|
|
|
|
|
sum=0;
|
|
|
|
|
for(i=count-1; i>=0; i--) { //<2F><>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD>λ<EFBFBD><CEBB>ʼ<EFBFBD><CABC>ÿλ<C3BF><CEBB>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD>
|
|
|
|
|
if(s[i]>='0'&&s[i]<='9') { //<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>
|
|
|
|
|
sum+=(s[i]-48)*pow(16,count-i-1);
|
|
|
|
|
} else if(s[i]>='A'&&s[i]<='F') { //<2F><>ĸ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>
|
|
|
|
|
sum+=(s[i]-55)*pow(16,count-i-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cout<<sum;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|