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

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簡化的處理下就行了,沒想到有點之間不能實現,看來不能偷懶,
只能用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 閱讀(207) 評論(0)  編輯 收藏 引用

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


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

常用鏈接

留言簿(8)

隨筆檔案

文章檔案

Friends

OJ

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            久久久精品动漫| 欧美岛国在线观看| 国产精品乱人伦中文| 亚洲一区二区三区国产| 99综合精品| 国产欧美日韩精品a在线观看| 欧美一级片在线播放| 欧美一区二区在线播放| 伊人久久婷婷| 亚洲欧洲精品一区二区三区波多野1战4 | 欧美电影电视剧在线观看| 久久久久久久网站| 亚洲理论在线观看| 国产精品99久久久久久久久| 国产日韩欧美三级| 欧美国产激情二区三区| 欧美日韩免费一区二区三区| 香蕉成人久久| 久久综合狠狠综合久久综合88| 亚洲激情视频在线播放| 99视频超级精品| 国产一区 二区 三区一级| 欧美好骚综合网| 国产精品久久久久三级| 免费成人在线观看视频| 欧美日韩综合在线免费观看| 久久久精彩视频| 欧美精品一区二区三区蜜桃| 久久国产精品久久久久久| 另类国产ts人妖高潮视频| 亚洲自拍三区| 欧美r片在线| 久久精品国产2020观看福利| 欧美a级大片| 久久黄色小说| 欧美三级不卡| 欧美黑人在线播放| 国产一区二区成人久久免费影院| 亚洲黄色在线观看| 海角社区69精品视频| 日韩午夜在线| 亚洲精品在线视频观看| 久久gogo国模裸体人体| 亚洲欧美日韩中文在线制服| 欧美高清视频一二三区| 久久久xxx| 国产精品视频网址| 日韩午夜av在线| 亚洲美女在线视频| 免费观看一级特黄欧美大片| 久久精品欧美日韩| 国产精品日本欧美一区二区三区| 亚洲人屁股眼子交8| 亚洲电影在线播放| 久久精品在线播放| 久久久久久综合| 国产视频亚洲| 在线观看精品一区| 亚洲欧美一区二区三区在线| 亚洲午夜在线视频| 欧美日韩国产小视频在线观看| 亚洲国产高清一区| 亚洲国语精品自产拍在线观看| 久久激情视频| 美女图片一区二区| 精品成人一区二区三区四区| 久久成人精品无人区| 久久久噜噜噜久久狠狠50岁| 国产日韩欧美制服另类| 午夜精品久久久久久久久久久久久 | 国产精品国色综合久久| 9色国产精品| 亚洲一区二区三区四区在线观看 | 国产精品美女视频网站| 亚洲午夜av| 欧美专区日韩专区| 国产一区二区三区四区五区美女| 午夜亚洲视频| 免费观看亚洲视频大全| 亚洲国产成人tv| 欧美成人综合在线| 亚洲精品中文字| 性欧美18~19sex高清播放| 国产女主播一区二区三区| 久久精彩视频| 亚洲成人在线视频网站| 亚洲视频在线观看网站| 国产精品最新自拍| 久久亚洲国产精品日日av夜夜| 欧美福利在线观看| 99综合在线| 国产欧美精品一区二区色综合 | 亚洲图片在区色| 久久久久一区二区三区| 亚洲激情电影中文字幕| 欧美日韩视频第一区| 性欧美暴力猛交另类hd| 欧美激情导航| 午夜视频精品| 91久久亚洲| 国产麻豆午夜三级精品| 噜噜噜噜噜久久久久久91| 亚洲天堂免费观看| 美女视频黄a大片欧美| 一区二区成人精品 | 欧美激情一区二区三区全黄| 亚洲视频专区在线| 欧美成人精品一区| 午夜视频久久久| 亚洲精品美女久久7777777| 国产精品成人一区二区网站软件 | 免费成人黄色av| 亚洲影院在线| 亚洲破处大片| 免费成人黄色av| 欧美一区亚洲二区| 夜夜爽www精品| 亚洲韩国精品一区| 国产伪娘ts一区| 国产精品jizz在线观看美国 | 国产精品久久一区主播| 免费日韩视频| 久久久精品动漫| 亚洲一区二区欧美| 日韩网站在线观看| 亚洲国产精品嫩草影院| 玖玖综合伊人| 久久精品夜色噜噜亚洲a∨ | 亚洲精品色婷婷福利天堂| 国产一区二区三区不卡在线观看 | 免费亚洲一区二区| 欧美中文字幕在线观看| 亚洲一区免费视频| 中国亚洲黄色| 中国成人亚色综合网站| 亚洲精品一二三区| 91久久精品美女高潮| 欧美成人一区二区在线| 免费日韩视频| 欧美成人一二三| 欧美国产日韩一区二区在线观看| 麻豆国产精品va在线观看不卡| 久久九九久精品国产免费直播| 午夜视频一区在线观看| 午夜一区二区三区在线观看 | 亚洲日本成人在线观看| 亚洲电影免费观看高清| 亚洲国产影院| 日韩视频一区二区三区在线播放免费观看 | 久久精品国产视频| 久久精品国产久精国产爱 | 亚洲国内欧美| 亚洲人成人77777线观看| 亚洲日本va午夜在线电影| 亚洲国产精选| 99国产精品久久久| 亚洲亚洲精品在线观看| 午夜精品在线看| 久久久久久成人| 欧美成人精品不卡视频在线观看| 欧美高清视频在线| 亚洲日本中文字幕免费在线不卡| 妖精成人www高清在线观看| 亚洲自拍电影| 久久久久久一区二区三区| 免费一级欧美片在线观看| 欧美日本韩国| 国产欧美日韩一区二区三区在线观看| 国产日韩欧美精品| 一区二区亚洲| 一本色道88久久加勒比精品 | 亚洲精品一区久久久久久| 中国成人黄色视屏| 久久国产高清| 亚洲国产精品一区二区久 | 毛片一区二区| 亚洲靠逼com| 久久精品99无色码中文字幕| 欧美大片在线看| 国产午夜一区二区三区| 精品动漫3d一区二区三区| 一区二区欧美日韩视频| 久久精品青青大伊人av| 亚洲高清不卡在线观看| 这里只有精品视频在线| 久久久综合精品| 国产精品成人一区二区| 亚洲国产精品999| 久久激情五月婷婷| 亚洲精品日韩在线| 久久久精品欧美丰满| 欧美私人网站| 91久久久在线| 久热re这里精品视频在线6| av不卡在线| 美日韩精品视频免费看| 国产亚洲欧美在线| 亚洲午夜在线| 亚洲人成网站777色婷婷| 久久成人免费|