摘要: 1 class Solution{ 2 public: 3 double myPow(double x,int n){ 4 if(1==x || n==0) return 1; 5 if(n == 1) return x; 6 if (n < 0) { 7 n = -n; 8 x = 1/x; 9 阅读全文
posted @ 2020-05-28 13:18 糖糖_彭 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 步骤: 1)先去除字符串收尾的空格 2)然后根据e划分指数和底数 3)判断指数和底数是否合法即可 1 class Solution { 2 public: 3 bool isNumber(string s) { 4 //首先去掉首尾的空格 5 int i = s.find_first_not_of( 阅读全文
posted @ 2020-05-28 12:57 糖糖_彭 阅读(245) 评论(0) 推荐(0) 编辑