标签:leedcode
class Solution { public: int titleToNumber(string s) { int ans = 0; int len = s.length(),i,j; for(i = 0; i<len; i++) { int cnt = len-1-i; int a = s[i]-'A'+1,q = 1; while(cnt--) q*=26; ans=ans+a*q; } return ans; } };
版权声明:本文为博主原创文章,如果转载,请注明出处
LeedCode OJ]#171 Excel Sheet Column Number
标签:leedcode
原文地址:http://blog.csdn.net/libin1105/article/details/48001709