1. 程式人生 > >牛課 等式(唯一分解定理求因子個數)

牛課 等式(唯一分解定理求因子個數)

#include<cstdio>
#include<cmath>
using namespace std;

int n, ans=1;

int main(){
	int t;
	scanf("%d", &t);
	while(t--)
	{
		ans=1;
		scanf("%d", &n);
	int m=sqrt(n+0.5);
	
	for(int i=2; i<=m; i++)
	{
		if(n%i==0)
		{
			
			int tmp=0;
			while(n%i==0){
				tmp++;
				n/=i;
			}
			ans*=(2*tmp+1);
		}
	}
	
	if(n>1) ans*=3;
	
	printf("%d\n", (ans+1)/2);	
	}
	
	return 0;
}