第二题 阶乘约数
代码:
public static void main(String[] args) {
int a = 180;
ArrayList<Integer> list = new ArrayList<>();
for (int i = 2; i <= 180; i++) {
ArrayList<Integer> copylist2 = new ArrayList<>();
for (int j = 2; j <= i; j++) {
if (i % j == 0) {
copylist2.add(j);
copylist2.add(i/j);
}
}
if (copylist2.size() <= 2) {
list.add(i);
}
copylist2.clear();
}
int count = 1;
for (int i = 0; i <list.size(); i++) {
int t = list.get(i);
int pq = 0;
int fp = 180;
while(fp % t == 0) {
fp = fp / t;
pq++;
}
count = count *(pq+1);
}
System.out.println(count);
}