The Descriptioninputoutput output file consists of n rows, one real number per line, and 3 digits after the decimal point. The real number on line I indicates how important node I is in social networks. Sample Input4 4
1 2 1
2 3 1
3 4 1
4 1 1Sample Output1.000
1.000
1.000
1.000HINT
is 1
See the data range, obviously floydmap[i][j] represents the shortest circuit of i-->j, A[i][j] represents the number of scenarios that represent the least-shorted scheme from I to J, which is zeroed when the minimum path is changed
1#include <cstdio>2#include <cstring>3 using namespacestd;4 Const intn= the, inf=1000000000;5 DoubleA[n][n];6 intn,m,u,v;7 Doubleans[n],map[n][n],w;8 intMain () {9scanf"%d%d",&n,&m);Ten for(intI=1; i<=n;i++) One for(intj=1; j<=n;j++) map[i][j]= (inf+0.0); A for(intI=1; i<=m;i++){ -scanf"%D%D%LF",&u,&v,&W); -Map[u][v]=map[v][u]= (w+0.0); thea[u][v]=a[v][u]=1; - } - for(intk=1; k<=n;k++) - for(intI=1; i<=n;i++) + for(intj=1; j<=n;j++){ - if(Map[i][j]>map[i][k]+map[k][j]) map[i][j]=map[i][k]+map[k][j],a[i][j]=0;; + if(map[i][j]== (Map[i][k]+map[k][j])) a[i][j]+=a[i][k]*A[k][j]; A } at for(intI=1; i<=n;i++) a[i][i]=0; - for(intk=1; k<=n;k++) - for(intI=1; i<=n;i++) - for(intj=1; j<=n;j++){ - if(map[i][j]== (map[i][k]+map[k][j]) &&a[i][j]>0) -ans[k]+=a[i][k]*a[k][j]/(a[i][j]+0.0); in } - for(intI=1; i<=n;i++) printf ("%.3lf\n", Ans[i]); to}
"Bzoj 1491" [NOI2007] Social network