1 class Solution { 2 public: 3 //计算一个整数的位数,在溢出判断中使用 4 int bit_length(int n) { 5 int l=0; 6 while(n!=0){ 7 l++; 8 n/=10; 9 } 10 return l; 11 } 12 int atoi(const char *str){ 13 if(*str=='