整数中1出现的次数

整数中1出现的次数

class Solution {
public:
int NumberOf1Between1AndN_Solution(int n)
{
if(n<=)
return ;
int count=;
int i=;
while(i<=n)
{
int p=i;
while(p)
{
if(p%==)
count++;
p=p/;
}
i++;
}
return count; }
};
04-24 17:28