题目:

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

代码:

 class Solution {
public:
int titleToNumber(string s) {
map<char, int> map;
int num = ;
int result = ;
for (char i = 'A'; i<='Z'; i++){
map[i] = num;
num++;
}
int j = ;
for(auto c = s.crbegin(); c<s.crend(); c++){
result = map[*c]*pow(, j) + result;
j++;
} return result;
}
};

最新文章

  1. PHP玩转微信公众平台自定义接口
  2. docker 1.8+之后ubuntu安装指定版本docker-engine
  3. qq邮箱邮我组件
  4. 【BZOJ】2321: [BeiJing2011集训]星器(数学+特殊的技巧)
  5. Java Swing 探索(一)LayoutManager
  6. 可视化Windows服务定时任务
  7. UNIX标准化及实现之标准之间的冲突
  8. url中的jsessionid解释
  9. 【转】JDBC学习笔记(1)——JDBC概述
  10. asp.net core系列 61 Ocelot 构建服务发现简单示例
  11. leetcode-217存在重复元素
  12. Maven的日常
  13. Vue.js路由
  14. 简单rmi示例
  15. MySQL RR模式下如何加锁
  16. Vivado抓取信号
  17. Python六大开源框架对比:Web2py略胜一筹(转)
  18. 20145333茹翔 Exp5 Adobe阅读器漏洞攻击
  19. jQuery 中的编程范式
  20. 【bzoj3203】[Sdoi2013]保护出题人 凸包+二分

热门文章

  1. LINQ 学习路程 -- 查询操作 Average Count Max Sum
  2. Luogu P1196 [NOI2002]银河英雄传说:带权并查集
  3. 十大最流行PHP框架排名
  4. 006-完全关闭win任务栏鼠标悬停预览
  5. Java进阶08 GUI
  6. CCSpriteBatchNode CCSpriteFrameCache
  7. CodeForces - 1C:Ancient Berland Circus (几何)
  8. 洛谷P2895 [USACO08FEB]流星雨Meteor Shower
  9. InvalidOperationException: out of sync
  10. 逐步改用 IronPython 开发你的 ASP.NET 应用程序