fork(5) download
  1. #include <cstdio>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int n, m, a, b, c, x[1100];
  6.  
  7. int main() {
  8. scanf("%d%d", &n, &m);
  9. for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  10. double ans = 0;
  11. for (int i = 1; i <= m; i++) {
  12. scanf("%d%d%d", &a, &b, &c);
  13. ans = max(ans, 1.0 * (x[a] + x[b]) / c);
  14. }
  15. printf("%.15lf\n", ans);
  16. }
Success #stdin #stdout 0s 3304KB
stdin
Standard input is empty
stdout
0.000000000000000