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 [问题描述] 在社交网络( ...
随机推荐
- 关于ClassLoader
http://blog.csdn.net/zztp01/article/details/6409355 http://blog.sina.com.cn/s/blog_6ec6be0e01011xof. ...
- 小兔JS教程(五) 简单易懂的JSON入门
上一节的参考答案: http://xiaotublog.com/demo.html?path=homework/04/index2 本节重点来介绍一下JSON,JSON(JavaScript Obje ...
- “权限系统_基于HUI”的简单介绍和交流
昂,最近比较闲,写了个权限系统. 后端框架还是老样子,基于本人自己搭建的后台基础开发框架"Spring_Mvc_EF":前端框架,我挑选了一阵子,最后选用了HUI前端开发框架,因为 ...
- HTML5和CSS3
一.HTML5 HTML5 是 HTML 标准的最新演进版本. 这个术语代表了两个不同的概念:它是一个新的 HTML 语言版本包含了新的元素,属性和行为,同时包含了一系列可以被用来让 Web 站点和应 ...
- iOS自定义视图- SJTextView
需求: textView 需要placeholder用来提示输入 textView 要做字数限制 textView 禁止表情符号的输入 思考: 因为需求比较通用,便想通过自定义SJTextView来实 ...
- 新生命组件XAgent使用心得
1.简单介绍 XAgent为大石头带领下的新生命团队自己开发的一个.Net下的常用的Windows服务管理组件利器,通过在控制台中简单的输入1,2,3,4,5等数字可以实现一步安装.卸载Windows ...
- 调用win32 api 函数SendMessage() 实现消息直接调用
简单的调用例子, 适合初学者学习,当然 我也是初学者. #include <windows.h> #include <stdio.h> #include <stdlib. ...
- 详解 swift2.2 和 OC 的混编
前言: 我们在一些情况下,仅仅使用swift 是无法完成一个项目的,在swift项目中必要用到 OC 实现一些功能,比如,项目要使用一些第三方的框架,但这个第三方的框架却是用 OC 实现的,或者你的项 ...
- java 重写的学习
本文全文转自:http://www.cnblogs.com/happyframework/p/3332243.html,非常感谢 Java中的重写规则比较灵活,具体如下: 除了 private 修饰之 ...
- Unity编程标准导引-3.2 MonoBehavior 组件父类重构
本文为博主原创文章,欢迎转载.请保留博主链接:http://blog.csdn.net/andrewfan 3.2MonoBehavior 组件父类重构 为了让我们的组件类用起来更方便,我们将上一节的 ...