给出一个整数,将它转化为excel表格列标号的形式(A,B,AB)
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
1 int titleToNumber(string s) { 2 int ans=0; 3 for(int i=0;i<s.length();i++){ 4 ans=ans*26+(s[i]-‘A‘+1); 5 } 6 return ans; 7 }
原文:http://www.cnblogs.com/li-xingtao/p/4226186.html