3164 质因数分解

 





 时间限制: 1 s



 空间限制: 256000 KB



 题目等级 : 黄金 Gold


​题解​


 


 


 






题目描述 Description



(多数据)给出t个数,求出它的质因子个数。

数据没坑,难度降低。



输入描述 Input Description



第一行 t

之后t行 数据



输出描述 Output Description



t行 分解后结果(质因子个数)



样例输入 Sample Input



2

11

6



样例输出 Sample Output



1

2



数据范围及提示 Data Size & Hint



(样例解释)11自己本身是一个质数,所以计入其中。

顺便提示:t<=100000。每个数小于long long unsigned 呵呵

 



#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
long long unsigned m;
int main(){
scanf("%d",&n);
while(n--){
cin>>m;
int k=2,ans=0;
while(m!=1&&m>=k){
while(m%k==0) m/=k,ans++;
k++;
}
cout<<ans<<endl;
}
}


 

 

 


细雨斜风作晓寒。淡烟疏柳媚晴滩。入淮清洛渐漫漫。 雪沫乳花浮午盏,蓼茸蒿笋试春盘。人间有味是清欢。