leetcode171

1 class Solution {
2 public:
3     int titleToNumber(string s) {
4        int tot=0,i;
5        for(i=0;i<s.size();i++)
6        tot=tot*26+s[i]-'A'+1;
7        return tot;
8     }
9 };

 

posted @ 2016-07-21 17:29  HYDhyd  阅读(137)  评论(0编辑  收藏  举报