superman

聚精会神搞建设 一心一意谋发展
posts - 190, comments - 17, trackbacks - 0, articles - 0
   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

ZOJ 1942 - Frogger

Posted on 2008-05-28 10:17 superman 阅读(512) 评论(1)  编辑 收藏 引用 所属分类: ZOJ
 1 /* Accepted 1942 C++ 00:00.22 1160K */
 2 #include <math.h>
 3 #include <iostream>
 4 
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     cout.setf(ios_base::showpoint);
10     cout.setf(ios_base::fixed);
11     cout.precision(3);
12     
13     int n, cnt = 1;
14     while(cin >> n && n)
15     {
16         struct { int x, y; } p[200];
17         for(int i = 0; i < n; i++)
18             cin >> p[i].x >> p[i].y;
19         
20         double dist[200][200= { 0.0 };
21         
22         for(int i = 0; i < n; i++)
23         for(int j = 0; j < n; j++)
24             dist[i][j] = pow(p[i].x - p[j].x, 2.0+ pow(p[i].y - p[j].y, 2.0);
25         for(int k = 0; k < n; k++)
26         for(int i = 0; i < n; i++)
27         for(int j = 0; j < n; j++)
28             dist[i][j] <?= max(dist[i][k], dist[k][j]);
29         cout << "Scenario #" << cnt++ << endl;
30         cout << "Frog Distance = " << sqrt(dist[0][1]) << endl << endl;
31     }
32     
33     return 0;
34 }
35 

Feedback

# re: ZOJ 1942 - Frogger  回复  更多评论   

2009-05-12 19:38 by 祝你好运!
dist[i][j] <?= max(dist[i][k], dist[k][j]);
什么意思?

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理