当前位置:网站首页>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);
}边栏推荐
- [MFC development (16)] tree control
- Matlab tips (23) matrix analysis -- simulated annealing
- Redis -- lattice connects to redis cluster
- Shell script echo command escape character
- Nacos - 服务发现
- Football and basketball game score live broadcast platform source code /app development and construction project
- Flink面试题
- 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
- Vsync+ triple cache mechanism +choreographer
- FAQ | FAQ for building applications for large screen devices
猜你喜欢

Phishing identification app

Do you know how data is stored? (C integer and floating point)

How to solve the problem of fixed assets management and inventory?

猿人学第20题(题目会不定时更新)

NiO zero copy

如何做好固定资产管理?易点易动提供智能化方案

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

钓鱼识别app

嵌入式工程师面试题3-硬件

FreeRTOS学习简易笔记
随机推荐
又到年中,固定资产管理该何去何从?
小鸟识别APP
Redis source code learning (29), compressed list learning, ziplist C (II)
Differences among tasks, threads and processes
Jetson nano installs tensorflow GPU and problem solving
Shell脚本-while循环详解
Performance improvement 2-3 times! The second generation Kunlun core server of Baidu AI Cloud was launched
通过 代码实例 理解 浅复制 与 深复制
C语言指针的进阶(上篇)
C language student information management system
Nacos - 配置管理
FAQ | FAQ for building applications for large screen devices
[interview brush 101] linked list
Public network cluster intercom +gps visual tracking | help the logistics industry with intelligent management and scheduling
易点易动助力企业设备高效管理,提升设备利用率
用C语言编程:用公式计算:e≈1+1/1!+1/2! …+1/n!,精度为10-6
An overview of the design of royalties and service fees of mainstream NFT market platforms
Embedded Engineer Interview Question 3 Hardware
Shell脚本-特殊变量:Shell $#、$*、[email protected]、$?、$$
Foundation: 3 Opencv getting started images and videos