当前位置:网站首页>Naoqi robot summary 28
Naoqi robot summary 28
2022-07-01 09:01:00 【hiyaaa】
#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;
}#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);
}边栏推荐
- 通过 代码实例 理解 浅复制 与 深复制
- Jetson Nano 安装TensorFlow GPU及问题解决
- Glitch free clock switching technology
- 日常办公耗材管理解决方案
- "Analysis of 43 cases of MATLAB neural network": Chapter 30 design of combined classifier based on random forest idea - breast cancer diagnosis
- Centos7 shell script one click installation of JDK, Mongo, Kafka, FTP, PostgreSQL, PostGIS, pgrouting
- C语言学生信息管理系统
- Advanced C language pointer (Part 2)
- Shell script - string
- 中断与其他函数共享变量、临界资源的保护
猜你喜欢

How can enterprises and developers take the lead in the outbreak of cloud native landing?

Bird recognition app

Nacos - service discovery

5mo3 UHI HII HII 17mn4 19Mn6 executive standard

Matlab tips (16) consistency verification of matrix eigenvector eigenvalue solution -- analytic hierarchy process

C语言指针的进阶(上篇)

VSYNC+三重缓存机制+Choreographer

Introduction to 18mnmo4-5 steel plate executive standard and delivery status of 18mnmo4-5 steel plate, European standard steel plate 18mnmo4-5 fixed rolling

Ranking list of domestic databases in February, 2022: oceanbase regained the "three consecutive increases", and gaussdb is expected to achieve the largest increase this month

FreeRTOS learning easy notes
随机推荐
It technology ebook collection
【MFC开发(16)】树形控件Tree Control
Guidelines and principles of did
Computer tips
[MFC development (17)] advanced list control list control
Brief introduction to AES
记一次redis超时
中考体育项目满分标准(深圳、安徽、湖北)
Vsync+ triple cache mechanism +choreographer
个人装修笔记
Insert mathematical formula in MD document and mathematical formula in typora
Shell script -for loop and for int loop
Interrupt sharing variables with other functions and protection of critical resources
Shell script -select in loop
pcl_viewer命令
Flink interview questions
How to manage fixed assets well? Easy to point and move to provide intelligent solutions
Dynamic proxy
Shell脚本-变量的定义、赋值和删除
美团2022年机试