标签:any pre tween number while offer count off ==
class Solution {
public:
int hwo_many(int n)
{
int count=0;
while(n!=0)
{
if(n%10==1)count++;
n/=10;
}
return count;
}
int NumberOf1Between1AndN_Solution(int n)
{
int count = 0;
for(int i=1;i<=n;i++){
count += hwo_many(i);
}
return count;
}
};
标签:any pre tween number while offer count off ==
原文地址:https://www.cnblogs.com/virgildevil/p/12227445.html