makrusak

1371

Feb 27th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <iostream>
  4. #include <algorithm>
  5. #include <vector>
  6. #include <string>
  7. #include <string.h>
  8. #include <queue>
  9. #include <stack>
  10. #include <deque>
  11. #include <map>
  12. #include <set>
  13. #include <cmath>
  14. #include <sstream>
  15.  
  16. #define pb push_back
  17. #define mp make_pair
  18. #define PI 3.1415926535897932384626433832795
  19. #define ALL(x) x.begin(), x.end()
  20. #define F first
  21. #define S second
  22. #define m0(x) memset(x,0,sizeof(x))
  23. #define m1(x) memset(x,-1,sizeof(x))
  24. #define pw(x) (1ull<<(x))
  25.  
  26. using namespace std;
  27. typedef long long ll;
  28. typedef unsigned long long ull;
  29. typedef long double ld;
  30. typedef pair<int,int> pii;
  31. const int INF = 2147483647;
  32. const ll LLINF = 9223372036854775807LL;
  33.  
  34. vector<pii> g[50010];
  35.  
  36. int dfs(int v, int p=0) {
  37.  
  38. }
  39.  
  40. int main() {
  41.   //freopen("input.txt", "r", stdin);
  42.   //freopen("output.txt", "w", stdout);
  43.   cin >> n;
  44.   for (int i=0;i<n-1;i++) {
  45.     int a,b,d; scanf("%d%d%d", &a, &b, &d); a--; b--;
  46.     g[a].pb(mp(b, d));
  47.     g[b].pb(mp(a, d));
  48.   }
  49.   printf("%.4lf", (double)dfs(1)/n/(n-1));
  50.   return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment