| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 800 人关注过本帖
标题:[求助]关于图论的一道题
取消只看楼主 加入收藏
zzyan
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-12-25
收藏
 问题点数:0 回复次数:1 
[求助]关于图论的一道题

Electric Wiring

Bill is designing electric wiring for his new house. First of all, he has fixed the positions of several electrical outlets on the walls. To neatly connect any pair of outlets, he would make sure that the wire is always imbedded in the walls or the floor, and is parallel to at least one side of the wall. Naturally he wants to minimize the total length of wire he must buy to have all the outlets connected.
By the way, do not forget that there is a door for every room. The wire must not cross the door. Figure 1 shows a possible setting in a room with 4 outlets.
Input Specification:
Your program must read test cases from a file “input.txt”. The input file consists of several test cases. For each test case, the first line contains 4 triples (x1, y1, z1) ... (x4, y4, z4) which are the coordinates of the four corners of a rectangular door. The second line contains size of the room, (Lx, Ly, Lz), and a positive integer N (<=20). Then N lines of coordinates (xi, yi, zi) of the outlets follow. Proceed until the end of file.
It is assumed that the cuboid room is completely in the first quadrant of the Cartesian coordinates with one of its corners at the origin, and the floor sits in x-y plane. It is guaranteed that each outlet belongs to one and only one of the four walls and no outlet is placed on the door. The two ends of a segment of wire must connect to outlets only.
Output Specification:
For each test case, output to a file “output.txt” in one line the nearest integer length of wire which can have all the outlets connected.

Sample Input:
0 0 0 0 0 3 1.5 0 0 1.5 0 3
10 10 10 4
0 1 3.3
2.5 0 2
5 0 0.8
5 10 1

Sample Output:
21

搜索更多相关主题的帖子: 图论 outlets wire Bill walls 
2006-12-25 23:09
zzyan
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-12-25
收藏
得分:0 
up
2006-12-26 13:39
快速回复:[求助]关于图论的一道题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033878 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved