171. Excel Sheet Column Number

 1 static int wing=[]()
 2 {
 3     std::ios::sync_with_stdio(false);
 4     cin.tie(NULL);
 5     return 0;
 6 }();
 7 
 8 class Solution 
 9 {
10 public:
11     int titleToNumber(string s) 
12     {
13         int res=0;     
14         for(char c:s)
15             res=res*26+(c-'A'+1);
16         return res;
17     }
18 };

二十六进制转十进制,比较简单

猜你喜欢

转载自www.cnblogs.com/zhuangbijingdeboke/p/9070609.html