1、其他进制转换成十进制,按照通用转换的模式做就行。
class Solution {
public:
int titleToNumber(string columnTitle) {
int sum=0,cnt=0;
int thesize=columnTitle.size();
while(cnt<thesize)
{
sum+=(columnTitle[thesize-1-cnt]-'A'+1)*pow(26,cnt);
++cnt;
}
return sum;
}
};