青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 74,  comments - 33,  trackbacks - 0
Building a Space Station
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 548 Accepted: 347

Description

You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task.
The space station is made up with a number of units, called cells. All cells are sphere-shaped, but their sizes are not necessarily uniform. Each cell is fixed at its predetermined position shortly after the station is successfully put into its orbit. It is quite strange that two cells may be touching each other, or even may be overlapping. In an extreme case, a cell may be totally enclosing another one. I do not know how such arrangements are possible.

All the cells must be connected, since crew members should be able to walk from any cell to any other cell. They can walk from a cell A to another cell B, if, (1) A and B are touching each other or overlapping, (2) A and B are connected by a `corridor', or (3) there is a cell C such that walking from A to C, and also from B to C are both possible. Note that the condition (3) should be interpreted transitively.

You are expected to design a configuration, namely, which pairs of cells are to be connected with corridors. There is some freedom in the corridor configuration. For example, if there are three cells A, B and C, not touching nor overlapping each other, at least three plans are possible in order to connect all three cells. The first is to build corridors A-B and A-C, the second B-C and B-A, the third C-A and C-B. The cost of building a corridor is proportional to its length. Therefore, you should choose a plan with the shortest total length of the corridors.

You can ignore the width of a corridor. A corridor is built between points on two cells' surfaces. It can be made arbitrarily long, but of course the shortest one is chosen. Even if two corridors A-B and C-D intersect in space, they are not considered to form a connection path between (for example) A and C. In other words, you may consider that two corridors never intersect.

Input

The input consists of multiple data sets. Each data set is given in the following format.

n
x1 y1 z1 r1
x2 y2 z2 r2
...
xn yn zn rn

The first line of a data set contains an integer n, which is the number of cells. n is positive, and does not exceed 100.

The following n lines are descriptions of cells. Four values in a line are x-, y- and z-coordinates of the center, and radius (called r in the rest of the problem) of the sphere, in this order. Each value is given by a decimal fraction, with 3 digits after the decimal point. Values are separated by a space character.

Each of x, y, z and r is positive and is less than 100.0.

The end of the input is indicated by a line containing a zero.

Output

For each data set, the shortest total length of the corridors should be printed, each in a separate line. The printed values should have 3 digits after the decimal point. They may not have an error greater than 0.001.

Note that if no corridors are necessary, that is, if all the cells are connected without corridors, the shortest total length of the corridors is 0.000.

Sample Input

3
10.000 10.000 50.000 10.000
40.000 10.000 50.000 10.000
40.000 40.000 50.000 10.000
2
30.000 30.000 30.000 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 10.671
80.115 63.292 84.477 15.120
64.095 80.924 70.029 14.881
39.472 85.116 71.369 5.553
0

Sample Output

20.000
0.000
73.834

Source

Japan 2003 Domestic
我暈 剛讀懂題目意思
我還想用Floyd簡(jiǎn)化的處理下就行了,沒想到有點(diǎn)之間不能實(shí)現(xiàn),看來不能偷懶,
只能用Dijiskal做了
代碼如下
for(i=0;i<n;i++){
????????????memset(flag,
0,sizeof(flag));
????????????
for(j=0;j<n;j++)
????????????????dis[j]
=map[i][j];
????????????
double?sum,Min;
????????????
int?sign;
????????????sum
=0;
????????????flag[i]
=1;
????????????
for(j=1;j<n;j++){
????????????????Min
=10000000;
????????????????
for(k=0;k<n;k++)
????????????????????
if(!flag[k]&&dis[k]<Min){
????????????????????????Min
=dis[k];
????????????????????????sign
=k;????
????????????????????}

????????????????flag[sign]
=1;
????????????????sum
+=Min;
????????????????
for(k=0;k<n;k++)
????????????????????
if(!flag[k]&&map[sign][k]<dis[k])
????????????????????????dis[k]
=map[sign][k];
????????????}

????????????
if(sum<min)min=sum;????
????????}
posted on 2009-02-20 21:51 KNIGHT 閱讀(209) 評(píng)論(0)  編輯 收藏 引用

只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2009年2月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
1234567

常用鏈接

留言簿(8)

隨筆檔案

文章檔案

Friends

OJ

搜索

  •  

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久久综合网| 欧美日韩免费观看一区| 国内不卡一区二区三区| 欧美亚洲在线| 香蕉乱码成人久久天堂爱免费 | 欧美大色视频| 欧美777四色影视在线| 夜夜嗨av一区二区三区| 99精品视频免费观看| 欧美日韩美女在线| 新67194成人永久网站| 亚洲一区国产一区| 国内偷自视频区视频综合| 美国十次了思思久久精品导航| 久久精品成人欧美大片古装| 亚洲国产婷婷香蕉久久久久久| 亚洲国产欧美一区二区三区同亚洲 | 久久精品视频免费| 91久久精品国产91久久| 亚洲免费成人av| 这里只有精品电影| 韩国精品在线观看| 91久久久精品| 国产精品自拍三区| 亚洲第一在线综合在线| 欧美日韩一区二区精品| 久久狠狠一本精品综合网| 久久婷婷影院| 亚洲嫩草精品久久| 久久久久一区二区| 亚洲欧美日韩高清| 嫩草影视亚洲| 欧美在线免费| 欧美精品1区| 久久久最新网址| 欧美日韩亚洲系列| 欧美韩国在线| 国产一区二区三区的电影| 亚洲日本aⅴ片在线观看香蕉| 国产精品一二| 亚洲精品在线电影| 在线观看中文字幕亚洲| 亚洲午夜精品一区二区| 亚洲精品乱码久久久久久| 欧美一区二区三区四区在线观看| 日韩一级不卡| 久久大逼视频| 久久精品九九| 国产精品福利在线| 亚洲欧洲一区二区在线播放| 国产亚洲毛片在线| 亚洲尤物影院| 亚洲永久免费精品| 欧美日韩精品不卡| 91久久综合| 亚洲国产高清自拍| 久久久www成人免费毛片麻豆| 午夜精品美女久久久久av福利| 欧美精品福利在线| 亚洲第一福利视频| 亚洲国产精品久久| 久久久综合视频| 麻豆av一区二区三区| 国内视频一区| 久久成人av少妇免费| 久久精品视频亚洲| 国产欧美欧洲在线观看| 亚洲在线视频观看| 亚洲在线视频| 国产精品欧美日韩一区二区| 在线视频日韩| 亚洲欧美日韩成人高清在线一区| 欧美亚州一区二区三区| 亚洲午夜精品| 欧美中文字幕久久| 国产主播一区二区| 久久综合九色九九| 亚洲欧洲精品一区二区三区不卡| 亚洲精品国产精品国自产观看| 欧美成人国产| 99视频一区二区三区| 亚洲综合色激情五月| 一区二区三区www| 午夜精品在线| 国产亚洲美州欧州综合国| 久久午夜国产精品| 亚洲精品视频在线看| 欧美黄色一区二区| 99在线观看免费视频精品观看| 亚洲调教视频在线观看| 国产欧美精品日韩| 久久日韩精品| 99国产精品自拍| 久久aⅴ国产紧身牛仔裤| 在线电影院国产精品| 欧美福利一区二区| 亚洲一区不卡| 欧美jizzhd精品欧美巨大免费| 亚洲精品一区二区在线| 国产精品盗摄久久久| 久久精品日产第一区二区三区| 1769国产精品| 国产精品www色诱视频| 久久精品一区二区三区不卡| 亚洲国产裸拍裸体视频在线观看乱了中文 | 欧美激情在线观看| 午夜精品在线看| 亚洲第一区在线观看| 欧美性猛交一区二区三区精品| 欧美一区二区三区免费大片| 一区二区在线视频观看| 欧美日韩在线三级| 久久久青草青青国产亚洲免观| 日韩视频第一页| 欧美成人国产| 欧美在线免费播放| 亚洲视频免费看| 亚洲韩国青草视频| 国产亚洲福利社区一区| 亚洲激情在线激情| 久久久久久亚洲综合影院红桃| 一区二区三区四区五区精品| 国模精品一区二区三区色天香| 欧美日韩一区在线视频| 麻豆国产精品一区二区三区| 亚洲欧美国产高清va在线播| 亚洲精品偷拍| 亚洲大胆在线| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美日韩一区综合| 欧美精品v日韩精品v韩国精品v| 久久精品动漫| 香蕉久久国产| 亚洲影视综合| 亚洲一区二区视频在线| 99精品国产99久久久久久福利| 欧美国产日本在线| 免费国产一区二区| 国产三级精品在线不卡| 欧美视频导航| 欧美三区美女| 欧美日韩国产一区| 欧美人与性动交α欧美精品济南到| 久久亚洲综合| 免费观看成人| 欧美国产欧美亚州国产日韩mv天天看完整 | 亚洲最快最全在线视频| 裸体一区二区三区| 久久久免费av| 蜜臀av性久久久久蜜臀aⅴ四虎| 久久九九精品| 鲁鲁狠狠狠7777一区二区| 久久久精品性| 蜜臀久久99精品久久久久久9| 蜜桃精品一区二区三区| 欧美激情第3页| 欧美视频二区| 国产欧美日韩亚洲一区二区三区| 国产精品一区二区久久久久| 国产美女一区| 影音先锋亚洲精品| 亚洲精品在线观看免费| 99热精品在线| 午夜亚洲视频| 久久综合九色综合欧美狠狠| 巨乳诱惑日韩免费av| 欧美激情精品久久久久久黑人| 亚洲黄页视频免费观看| 一区二区三区视频观看| 亚洲欧美激情视频| 久久婷婷麻豆| 欧美日韩在线高清| 黑人巨大精品欧美一区二区| 91久久国产自产拍夜夜嗨| 一本色道综合亚洲| 久久电影一区| 亚洲国产精品成人综合色在线婷婷| 亚洲日本欧美天堂| 欧美亚洲午夜视频在线观看| 老色鬼精品视频在线观看播放| 欧美日韩国产色站一区二区三区| 国产精品伊人日日| 91久久亚洲| 午夜视频久久久久久| 欧美激情黄色片| 亚洲图片自拍偷拍| 美女主播一区| 国产欧美亚洲日本| 日韩一区二区高清| 久久精品91| 日韩一级黄色大片| 久久一区视频| 亚洲尤物精选| 欧美日韩1080p| 影视先锋久久| 久久成人一区| 一区二区高清在线观看| 久久综合一区二区| 亚洲一区二区日本| 欧美人与性动交α欧美精品济南到|