|
/**********
*@author map
*@email godmap@126.com
*@qq 9842058
*********/
/*****************************
*算出小于100000的含有1的正整数的个数
****************************/
public class Num {
public static void main (String[] args) {
int i,j,k,l,m;
int count=0;
for (i=0; i<=9; i++) {
for (j=0; j<=9; j++) {
for (k=0; k<=9; k++) {
for (l=0; l<=9; l++) {
for (m=0; m<=9; m++) {
if (i==1 || j==1 || k==1 || l==1 || m==1) {
System.out.print(i);
System.out.print(j);
System.out.print(k);
System.out.print(l);
System.out.println(m);
count++;
}
}
}
}
}
}
System.out.println("Total: "+(count+1));
}
} |
|