文章
17
粉丝
177
获赞
2
访问
118.7k
#include<stdio.h>
#include<math.h>
long factor_sum(long n){
long sum = 0;
for(long i = 1;i <= sqrt(n);i++){
if(n % i == 0){
if(n / i == i) sum++;
else sum += 2;
}
}
return sum;
}
int main()
{
int n;
long num;
while(scanf("%d", &n)!= EOF){
for(int i = 0;i < n;i++){
scanf("%ld", &num);
printf("%ld\n", factor_sum(num));
}
}
}
登录后发布评论
暂无评论,来抢沙发