你说得对但我是暴力大蛇
原题链接:50244.小午的质因子统计2025-06-15 22:05:10
发布于:北京
该算法能过不亚于 过百万。
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a,i;
set<int> s;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
for(int j=2;j*j<=a;j++)
{
if(a%j==0)
{
s.insert(j);
while(a%j==0)a/=j;
}
}
if(a>1)s.insert(a);
}
cout<<s.size();
return 0;
}
全部评论 1
挑战赛笑传之code crush bag(数据 bag)
2天前 来自 北京
1意为:(暴力)代码碾压(数据)包
2天前 来自 北京
1
有帮助,赞一个