https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=6292
给一个数 问起gcd/lcm的哈斯图有多少条边
发现哈斯图每个点上的数有几个素因子 就向下连几条边 然后素因子分解一下就完事了
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
ll pre[maxn],cnt[maxn];
ll n;
int tot;
int main()
{
ll sum,ans,i;
int t;
scanf("%d",&t);
while(t--){
scanf("%lld",&n);
tot=0;
for(i=2;i*i<=n;i++){
if(n%i==0){
tot++;
pre[tot]=i,cnt[tot]=0;
while(n%i==0){
n/=i;
cnt[tot]++;
}
}
}
if(n!=1){
tot++;
pre[tot]=n,cnt[tot]=1;
}
sum=1ll;
for(i=1;i<=tot;i++) sum*=(cnt[i]+1ll);
ans=0;
for(i=1;i<=tot;i++) ans+=(sum/(cnt[i]+1ll))*cnt[i];
printf("%lld\n",ans);
}
return 0;
}