标签:
https://leetcode.com/problems/excel-sheet-column-number/
class Solution {
public:
int titleToNumber(string s) {
int ans = 0;
for(int i = 0;i < s.length();i++)
{
ans *= 26;
ans += s[i] - ‘A‘ + 1;
}
return ans;
}
};
Leetcode 171 Excel Sheet Column Number 难度:0
标签:
原文地址:http://www.cnblogs.com/xuesu/p/4757892.html