class Solution {
public:
int count_1(int v)
{
int count=0;
while(v)
{
if(v%10==1)
{
count++;
}
v/=10;
}
return count;
}
int NumberOf1Between1AndN_Solution(int n) {
if(n==0)
{
return 0;
}
int count=0;
for(int i=1;i<=n;i++)
{
count+=count_1(i);
}
return count;
}
};



京公网安备 11010502036488号