【Codeforces 444A】DZY Loves Physics

【链接】 我是链接,点我呀:)
【题意】


题意

【题解】


两个点的子图他们的"密度"是比所有联通生成子图都要大的
"只要胆子大,遇到什么问题都不怕!"

【代码】

#include <bits/stdc++.h>
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i>= b;i--)
#define ll long long
using namespace std;

const int N = 500;

int n,m;
int a[N+10];

int main(){
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n >> m;
    rep1(i,1,n) cin >> a[i];
    double ans = 0;
    rep1(i,1,m){
        int x,y,z;
        cin >> x >> y >> z;
        double temp = 1.0*(a[x]+a[y])/z;
        ans = max(ans,temp);
    }
    cout<<fixed<<setprecision(15)<<ans<<endl;
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/AWCXV/p/10674198.html