相似题型:LeetCode 168. Excel Sheet Column Title
代码:
class Solution { public: int titleToNumber(string s) { int ret = 0; for (size_t i = 0; i < s.size(); ++ i) { ret *= 26; ret += (s[i] - 'A' + 1); } return ret; } };
LeetCode 171. Excel Sheet Column Number
原文地址:http://blog.csdn.net/stephen_wong/article/details/43924505