#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
cout<<(4*(sqrt(1.0*a*c/b)+sqrt(1.0*a*b/c)+sqrt(1.0*b*c/a)))<<endl;
return 0;
}
P3387 【模板】缩点 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
#include<iostream>
#include<queue>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 10010
#define M 200010
#define LL long long
using namespace std;int n,m,v[N],le[N],lg[N],tote,totg,a,b,rd[N],f[N];
struct node{int next,to;}e[M],g[M];
inline void adde(int u,int v){e[++tote]=(node){le[u],v};le[u]=tote;return;}
inline void addg(int u,int v){g[++totg]=(node){lg[u],v};lg[u]=totg;return;}
bool vis[N];
int low[N],dfn[N],stk[N],top,cnt,which[N];
inline void Tarjan(int x)
{
low[x]=dfn[x]=++cnt;
stk[++top]=x;vis[x]=true;
for(register int i=le[x];i;i=e[i].next)
{
int y=e[i].to;
if(dfn[y]==0)
{
Tarjan(y);
low[x]=min(low[x],low[y]);
}
else if(vis[y]) low[x]=min(low[x],dfn[y]);
}
if(dfn[x]==low[x])
{
int y;
while(y=stk[top--])
{
which[y]=x;vis[y]=false;
if(x==y) break;
v[x]+=v[y];
}
return;
}
}
signed main()
{
cin>>n>>m;
for(register int i=1;i<=n;i++) cin>>v[i];
for(register int i=1;i<=m;i++) cin>>a>>b,adde(a,b);
for(register int i=1;i<=n;i++) if(!dfn[i]) Tarjan(i);
for(register int x=1;x<=n;x++)
for(register int i=le[x];i;i=e[i].next)
{
int y=e[i].to;
if(which[x]!=which[y]) addg(which[x],which[y]),rd[which[y]]++;
}
queue<int>q;
for(register int i=1;i<=n;i++) if(which[i]==i&&rd[i]==0) q.push(i),f[i]=v[i];
while(q.size())
{
int x=q.front();q.pop();
for(register int i=lg[x];i;i=g[i].next)
{
int y=g[i].to;
f[y]=max(f[y],f[x]+v[y]);
if(--rd[y]==0) q.push(y);
}
}
int res=0;
for(register int i=1;i<=n;i++) res=max(res,f[i]);
printf("%d",res);
}