赞
踩
public List<Integer> selfDividingNumbers(int left, int right) { List<Integer> list = new ArrayList<>(); for (int i = left; i <= right; i++) { List<Integer> list1 = new ArrayList<>(); int num =i; boolean boo=false; while (num>0){ if (num%10==0){ boo=true; } list1.add(num%10); num/=10; } if (boo){ continue; } boolean b=true; for (int j = 0; j < list1.size(); j++) { if (i%list1.get(j)==0){ continue; } b=false; } if (b){ list.add(i); } } return list; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。