package sort;
public class Test43 {
public static void main(String[] args) {
System.out.println(findones(451));
//解析 https://blog.csdn.net/ds19980228/article/details/82748063
}
public static int findones(int n) {
int count = 0;
int high = n;
int low =0;
int base = 1;
while (high != 0) {
int temp=high;
high=temp/10;
low =temp%10;
count += high * base;
if (low == 1)
count += n % base + 1;
if (low > 1)
count += base;
base*=10;
}
return count;
}
}