import java.io.IOException;
import java.io.FileReader;
import java.io.BufferedReader;
import java.util.Scanner;
import java.util.Vector;
class Main
{
public static final boolean DEBUG = false;
public static void main(String[] args) throws IOException
{
Scanner cin;
int n;
if (DEBUG) {
cin = new Scanner(new BufferedReader(new FileReader("d:\\OJ\\uva_in.txt")));
} else {
cin = new Scanner(System.in);
}
Vector<Integer> vPrime;
boolean[] vis = new boolean[100001];
vis[0] = vis[1] = true;
for (int i = 2; i < 1000; i++) {
if (!vis[i]) {
for (int j = i * i; j < 100001; j += i) {
vis[j] = true;
}
}
}
vPrime = new Vector<Integer>();
for (int i = 2; i < 100001; i++) {
if (!vis[i]) {
vPrime.add(new Integer(i));
}
}
while (cin.hasNext()) {
n = cin.nextInt();
if (n == 0) break;
while (n-- > 0) {
int num = cin.nextInt();
int ans = 1;
for (int i = 0; i < vPrime.size(); i++) {
int p = vPrime.get(i).intValue();
if (p > num)
break;
if (num % p == 0) {
int c = 0;
while (num % p == 0) {
c++;
num /= p;
}
ans *= (c + 1);
}
}
if (num != 1) {
ans *= 2;
}
System.out.println(ans);
}
}
}
}
题目1087:约数的个数
最新推荐文章于 2020-03-19 13:11:49 发布