public Double getNum(int num){
return this.nums.get(num);
}
}
public class NumTest {
public static void main(String[] args) throws IOException {
NumTest nt = new NumTest();
System.out.println("请输入正整数N(100<N<1000000)");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int [] nums; //存储输入数字
int count=0; //统计输入的数字数量
String line;
while(!("over".equals(line=br.readLine()))){
sb.append(line+" ");
count++;
}
nums = new int[count];
String [] ns = sb.toString().split(" ");
for(int i =0;i<ns.length;i++){
nums[i]=Integer.valueOf(ns[i]);
if(nums[i]<100 ||nums[i]>1000000)
throw new RuntimeException("您输入的数字已超出范围");
System.out.println(nt.calName(nums[i]));;
}
}
//计算num的类型
public String calName(int num){
String numName = "numName: ";
char [] c ={'b','q','w','s'}; //'b'--3位数 'q'--四位数 'w'--代表五位数 's'--代表六位数
//将整数换成字符串判断几位
String len = String.valueOf(num);
char flag =c[len.length()-3]; //判断该整数对应c[]数组中的字符
double sum=0;
switch(flag){
case 'b':
for(int i=0;i<len.length();i++){
int index=Character.getNumericValue(len.charAt(i));
sum+=BeautyNums.Daffodil.getNum(index);
}
if(sum==num){
numName+="D";
}else{
numName+="N";
}
break;
case 'q':