- 问答
- 2020-06-14 22:05:15 @
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 100001;
const int MAXM = 100001;
struct edge {
int u, v, w;
double val;
} edges[MAXM];
int a[MAXN];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
double maxval = 0;
for (int i = 0; i < m; i++) {
scanf("%d %d %d", &edges[i].u, &edges[i].v, &edges[i].w);
edges[i].val = (a[edges[i].u] + a[edges[i].v]) * 1.0 / edges[i].w;
maxval = max(maxval, edges[i].val);
}
printf("%.2lf", maxval);
return 0;
}
为什么我的代码在BSOJ上过了,却无法在GMQOJ上过呢(MLE)
2 条评论
-
yinjun2024 (c2024殷骏) LV 8 MOD @ 2020-06-14 22:54:45
------结贴------
-
2020-06-14 22:53:35@
OK,谢谢
- 1