DreamAngel
如果你希望成功,以恒心為良友,以經驗為參謀,以小心為兄弟,以希望為哨兵。
BlogJava
首頁
新隨筆
聯系
聚合
管理
隨筆 - 147 文章 - 71 trackbacks - 0
<
2025年7月
>
日
一
二
三
四
五
六
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
我的其它Blog:
www.cppblog.com/dreamangel/
blog.csdn.net/fjnu_angel/
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆分類
(146)
ACM(28)
ajax(9)
eclipse(3)
Game(6)
Hibernate(1)
java(20)
javascript(19)
jfreechart(3)
jfreereport(1)
JSP(16)
linux(4)
log4j(3)
Spring(1)
SQL(7)
Struts(3)
Tomcat(3)
其它(12)
正則表達式(3)
網絡管理(2)
軟件設計(2)
隨筆檔案
(147)
2015年4月 (1)
2013年9月 (2)
2013年8月 (1)
2013年3月 (1)
2012年8月 (2)
2012年7月 (1)
2012年6月 (1)
2012年5月 (2)
2012年3月 (2)
2012年2月 (1)
2012年1月 (2)
2011年12月 (3)
2011年11月 (6)
2011年10月 (6)
2011年9月 (1)
2010年5月 (1)
2010年4月 (1)
2010年1月 (1)
2009年12月 (3)
2009年11月 (7)
2009年10月 (7)
2009年9月 (9)
2009年8月 (6)
2009年7月 (17)
2009年6月 (8)
2009年5月 (8)
2009年4月 (4)
2009年3月 (17)
2009年2月 (16)
2009年1月 (10)
文章分類
(28)
foj(3)
poj(15)
spoj(9)
zoj(1)
文章檔案
(28)
2010年9月 (2)
2010年7月 (1)
2009年9月 (14)
2009年8月 (11)
喜歡的Blog
BeanSoft
fuhoujun
yoyo
不朽的飛翔
樂在其中
宇天
我和hacker有個約會
銀河使者
阿蜜果
搜索
最新評論
1.?re: MyEclipse6.5 注冊碼生成方法,自己輸入用戶名[未登錄]
5656
--lk
2.?re: MyEclipse6.5 注冊碼生成方法,自己輸入用戶名
henhaoyong
--wuxiaoming
3.?re: MyEclipse6.5 注冊碼生成方法,自己輸入用戶名
wuxiaoming
--wuxiaoming
4.?re: js獲得table單元格的信息
颯沓
--阿爾
5.?re: log4j:ERROR Failed to rename錯誤解決辦法[未登錄]
謝謝樓主,問題解決!
--bobo
閱讀排行榜
1.?用戶權限管理設計(33602)
2.?關于路由器設置DI-504的401 Unauthorized authorization required(19093)
3.?ubuntu下gcc的安裝與使用(18764)
4.?Proguard使用教程(12620)
5.?ExtJS的tbar布局(10595)
評論排行榜
1.?MyEclipse6.5 注冊碼生成方法,自己輸入用戶名(14)
2.?用戶權限管理設計(9)
3.?OA系統權限管理設計方案(7)
4.?判斷一個月有多少天(正確的方法)(4)
5.?泰訊軟件數據庫筆試題目(SQL Server 2000版)(3)
poj1125(Stockbroker Grapevine)
http://acm.pku.edu.cn/JudgeOnline/problem?id=1125
【題意簡述】有向圖(互相之間可能不等)中各頂點之間的最短路徑問題。一個人收到消息后便開始向所有他能發送的人(因人以固定的不等時間(長度1~10))發送消息,當所有人都收到消息后的時間長短為評價標準。
【分析】Floyd算法。POJ這題的測試數據不嚴密,沒有寫disjoint也可以AC。
import
java.util.
*
;
import
java.io.
*
;
public
class
poj_1125
{
public
static
void
main(String rgs[])
throws
Exception
{
Scanner cin
=
new
Scanner(
new
BufferedInputStream(System.in));
int
i,j,k,t
=
0
,e,s,n
=
cin.nextInt();
while
(n
!=
0
)
{
int
[][] a
=
new
int
[n
+
1
][n
+
1
];
for
(i
=
1
;i
<=
n;i
++
)
Arrays.fill(a[i],
0xfffff
);
for
(i
=
1
;i
<=
n;i
++
)
{
t
=
cin.nextInt();
for
(j
=
1
;j
<=
t;j
++
)
{
e
=
cin.nextInt();
s
=
cin.nextInt();
a[i][e]
=
s;
}
}
for
(k
=
1
;k
<=
n;k
++
)
{
for
(i
=
1
;i
<=
n;i
++
)
{
for
(j
=
1
;j
<=
n;j
++
)
{
if
(a[i][k]
+
a[k][j]
<
a[i][j])
a[i][j]
=
a[i][k]
+
a[k][j];
}
}
}
int
min
=
0xfffff
,max;
k
=
0
;
for
(i
=
1
;i
<=
n;i
++
)
{
max
=
0
;
for
(j
=
1
;j
<=
n;j
++
)
{
if
(i
!=
j
&&
a[i][j]
>
max)
max
=
a[i][j];
}
if
(max
<
min)
{
min
=
max;
k
=
i;
}
}
if
(k
>
0
)
System.out.println(k
+
"
"
+
min);
else
System.out.println(
"
disjoint
"
);
n
=
cin.nextInt();
}
}
}
posted on 2009-09-18 10:16
飛翔天使
閱讀(1079)
評論(0)
編輯
收藏
所屬分類:
poj
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
poj1157(LITTLE SHOP OF FLOWERS)
poj1396(Simple Arithmetics)
poj ACM題型分類
poj1125(Stockbroker Grapevine)
poj1835(宇航員)
poj1163(The Triangle)
poj1118(Lining Up)
poj1129(Channel Allocation)
poj1016(Numbers That Count)
poj1001(Exponentiation)
Copyright ©2025 飛翔天使 Powered by:
博客園
模板提供:
滬江博客
主站蜘蛛池模板:
东乌珠穆沁旗
|
宁陵县
|
班玛县
|
新建县
|
英山县
|
阿拉善盟
|
三台县
|
鹿泉市
|
黄山市
|
永新县
|
衡山县
|
丹江口市
|
麻江县
|
屯昌县
|
石棉县
|
白水县
|
富源县
|
上饶县
|
河西区
|
同仁县
|
横峰县
|
酉阳
|
内乡县
|
宁河县
|
玉树县
|
浮梁县
|
曲麻莱县
|
天峨县
|
基隆市
|
忻城县
|
大余县
|
澄江县
|
高雄县
|
额尔古纳市
|
荔波县
|
清水县
|
陵水
|
兴隆县
|
家居
|
中西区
|
吉木萨尔县
|