codevs 3164 质因数分解
生活随笔
收集整理的這篇文章主要介紹了
codevs 3164 质因数分解
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
3164 質(zhì)因數(shù)分解
?
?時間限制: 1 s ?空間限制: 256000 KB ?題目等級 : 黃金 Gold 題解 ? ? ? 題目描述?Description(多數(shù)據(jù))給出t個數(shù),求出它的質(zhì)因子個數(shù)。
數(shù)據(jù)沒坑,難度降低。
輸入描述?Input Description第一行 t
之后t行 數(shù)據(jù)
輸出描述?Output Descriptiont行 分解后結(jié)果(質(zhì)因子個數(shù))
樣例輸入?Sample Input2
11
6
樣例輸出?Sample Output1
2
數(shù)據(jù)范圍及提示?Data Size & Hint(樣例解釋)11自己本身是一個質(zhì)數(shù),所以計入其中。
順便提示:t<=100000。每個數(shù)小于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;} }?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/cangT-Tlan/p/9609212.html
總結(jié)
以上是生活随笔為你收集整理的codevs 3164 质因数分解的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: .NET下日志系统的搭建——log4ne
- 下一篇: linux 基本的操作