标签:
Related to question Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28
相关题目:Excel 表格列标题
给定一个出现在Excel表格中的列标题,返回其对应的列号。
样例如题目描述。
水题,26进制转化为10进制
1 class Solution { 2 public: 3 int titleToNumber(string s) { 4 int ret=0; 5 for(int i=0;i<s.size();i++) 6 { 7 ret=ret*26+(s[i]-‘A‘+1); 8 } 9 return ret; 10 } 11 };
171. Excel Sheet Column Number(C++)
标签:
原文地址:http://www.cnblogs.com/19q3/p/5493013.html