1491: [NOI2007]社交网络
1491: [NOI2007]社交网络
Time Limit: 10 Sec Memory Limit: 64 MB
Submit: 881 Solved: 518
[Submit][Status]
Description

Input

Output
Sample Input
1 2 1
2 3 1
3 4 1
4 1 1
Sample Output
1.000
1.000
1.000
HINT
为1
Source
var
i,j,k,l,m,n,s,t:longint;
a,b:array[..,..] of int64;
c:array[..] of int64;
d:array[..] of extended;
begin
readln(n,m);
fillchar(a,sizeof(a),);
fillchar(b,sizeof(b),);
for i:= to n do b[i,i]:=;
for i:= to m do
begin
readln(j,k,l);
a[j,k]:=l;a[k,j]:=l;
b[j,k]:=;b[k,j]:=;
end;
for k:= to n do
for i:= to n do
begin
if (i<>k) and (a[i,k]>) then
begin
for j:= to n do
begin
if (i<>j) and (j<>k) and (a[k,j]>) then
begin
if ((a[k,j]+a[i,k])=a[i,j]) then
begin
b[i,j]:=b[i,j]+(b[i,k]*b[k,j]);
end
else
begin
if ((a[k,j]+a[i,k])<a[i,j]) or (a[i,j]=) then
begin
a[i,j]:=a[k,j]+a[i,k];
b[i,j]:=b[i,k]*b[k,j];
end;
end;
end;
end;
end;
end;
fillchar(d,sizeof(d),);
for s:= to n do
for t:= to n do
begin
if s=t then continue;
fillchar(c,sizeof(c),);
for i:= to n do
begin
if (s=i) or (t=i) then continue;
if (a[s,i]+a[i,t])<>a[s,t] then continue;
d[i]:=d[i]+(b[s,i]*b[i,t])/b[s,t];
end;
end;
for i:= to n do writeln(d[i]::);
end.
1491: [NOI2007]社交网络的更多相关文章
- BZOJ 1491 [NOI2007]社交网络
1491: [NOI2007]社交网络 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 1159 Solved: 660[Submit][Status] ...
- BZOJ 1491: [NOI2007]社交网络( floyd )
floyd...求最短路时顺便求出路径数. 时间复杂度O(N^3) ------------------------------------------------------------------ ...
- BZOJ1491:1491: [NOI2007]社交网络
1491: [NOI2007]社交网络 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 2204 Solved: 1175[Submit][Status ...
- 【BZOJ】1491: [NOI2007]社交网络(floyd)
http://www.lydsy.com/JudgeOnline/problem.php?id=1491 囧囧囧...................... 囧1:虽然自己想到做法了,但是操作的时候, ...
- 1491: [NOI2007]社交网络 - BZOJ
Description Input Output输出文件包括n 行,每行一个实数,精确到小数点后3 位.第i 行的实数表 示结点i 在社交网络中的重要程度.Sample Input4 41 2 12 ...
- BZOJ 1491: [NOI2007]社交网络(Floyd+暴力乱搞)
题面: https://www.lydsy.com/JudgeOnline/problem.php?id=1491 题解: 先看数据范围,n<=100..欸可以乱搞了 首先因为小学学过的乘法原理 ...
- 1491. [NOI2007]社交网络【最短路计数】
Description 在社交网络(socialnetwork)的研究中,我们常常使用图论概念去解释一些社会现象.不妨看这样的一个问题. 在一个社交圈子里有n个人,人与人之间有不同程度的关系.我们将这 ...
- [BZOJ1491][NOI2007]社交网络 floyd
1491: [NOI2007]社交网络 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 2196 Solved: 1170[Submit][Status ...
- 图论(floyd算法):NOI2007 社交网络
[NOI2007] 社交网络 ★★ 输入文件:network1.in 输出文件:network1.out 简单对比 时间限制:1 s 内存限制:128 MB [问题描述] 在社交网络( ...
随机推荐
- Flash Socket通信的安全策略问题 843端口
1.问题描述 将flash发布为html格式后,加载页面后,swf无法与服务器进行socket通信.Flash端显示的错误为:securityErrorHandler信息: [Securi ...
- Microsoft IoT Starter Kit 开发初体验-反馈控制与数据存储
在上一篇文章<Microsoft IoT Starter Kit 开发初体验>中,讲述了微软中国发布的Microsoft IoT Starter Kit所包含的硬件介绍.开发环境搭建.硬件 ...
- Google中Gson的使用解析json数据-------学习篇
之前写过一篇Gson解析json数据的基本应用,这里不多说,直接上例子. 有兴趣的可以先阅读下之前那篇,这里附上链接: http://www.cnblogs.com/Ant-soldier/p/632 ...
- 我的音乐盒子(nodejs7 + koa2 + vue + vuex + vue-router)
你们知道的,nodejs对jser来说,是个好东西,快快的,自从接触nodejs后,总想弄点东西. 这弄个啥了,一天打开百度音乐盒,哟,自己弄一个如何了,好啊好啊. 后台: nodejs 7 + ko ...
- (一)Redis在windows下的安装和使用
1.下载redis服务端,地址:https://github.com/MSOpenTech/redis/releases 包含安装程序和源码. 2.解压<Redis-x64-3.2.100.zi ...
- WebForm 控件(一)、连接数据库
一.控件 [简单控件] (一)文字显示 1.Label → 在html中相当于span <asp:Label ID="控件名 runat="server" Tex ...
- sonarqube+Scanner代码质量管理工具
本文相关描述基于sonarqube 6.2版本. 下载地址: sonarqube下载网址:https://www.sonarqube.org/downloads/ Scanner下载网址(用于扫描项目 ...
- mysql 打开sql日志,记录所有sql
我使用的mysql版本为:5.7.11 win7环境 记录下下载地址,省得每次百度搜了:http://dev.mysql.com/downloads/installer/ mysql 默认没有开启sq ...
- C语言 extern3 全局变量的使用
和函数的全局使用极其类似: 第一种方法,也是最简单的: 在 first.h 中定义, ; 在对应的first.c中使用: #include "first.h" #include & ...
- Java 程序测试_判断语句
package test; public class Condition_Phase { public static void main (String[] args) { //The Traditi ...