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 [问题描述] 在社交网络( ...
随机推荐
- validform表单验证插件最终版
做个笔记,以后直接用吧. 报名界面: <%@ page language="java" pageEncoding="UTF-8" contentType= ...
- ASP.NET Zero--14.一个例子(7)商品分类管理-分类搜索及分页
分类搜索实现 1.添加搜索框 打开Index视图,添加一个搜索框,代码如下: ... <div class="portlet light"> <div class ...
- OpenCV 3.2正式发布啦
2016年12月23号OpenCV社区宣布了OpenCV3.2版本正式发布,这个是在OpenCV3.1版本发布一年以后再次升级.在3.2版本中有总数超过数千个的改进与修正,是OpenCV3.x系列中最 ...
- Python学习--13 文件I/O
Python内置了读写文件的函数,用法和C是兼容的. 读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现代操作系统不允许普通的程序直接操作磁盘,所以,读写文件就是请求操作系 ...
- vue1.0学习总结
前言 使用vue已经有三.四个月了,但是只是学着使用了一些基本方法.因为现在的前端框架越来越多(Angular,React...),但是我相信万变不离其宗,很多用法框架之间还是想通的,所以借总结的vu ...
- windows下搭建GO开发环境
1. Go下载 由于某些原因golang.org不能访问,可以使用下面的镜像地址进行下 http://fossies.org/windows/misc/ 我的环境是win8 64位,所以选择go1.7 ...
- sql递归查询语句
sql Bom 递归查询: with t as(select * from Department where id=6union allselect a.* from Department a,t w ...
- Cassandra issue - "The clustering keys ordering is wrong for @EmbeddedId"
在Java连接Cassandra的情况下, 当使用组合主键时, 默认第一个是Partition Key, 后续的均为Clustering Key. 如果有多个Clustering Key, 在Java ...
- Python之文件与目录操作及压缩模块(os、shutil、zipfile、tarfile)
Python中可以用于对文件和目录进行操作的内置模块包括: 模块/函数名称 功能描述 open()函数 文件读取或写入 os.path模块 文件路径操作 os模块 文件和目录简单操作 zipfile模 ...
- 2017年2月16日-----------乱码新手自学.net 之MVC模型
第二篇博文,最近学习的内容还是回到了正题:ASP.NET MVC5之上.虽然EF学了个一知半解,但是用这点知识,看MVC5的MODEL部分应该还是够了.尽管周末还要恶补一下EF才行. (一)MVC简述 ...