| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 566 人关注过本帖
标题:Pathfinder的问题,请大神指点一二!
只看楼主 加入收藏
maxyu718
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-11-22
结帖率:0
收藏
已结贴  问题点数:20 回复次数:5 
Pathfinder的问题,请大神指点一二!
Pathfinder. Write a text-based program that reads a set of coordinates from a text file and outputs on the screen the path that can visit all the coordinates starting from the first coordinate in the file, and at every step moving to the nearest coordinate that has not been visited before. The maximum number of coordinates in the file is 10. The format of the text file consists of one coordinate per line where the x,y point is described by two integer numbers between 0 and 100 separated by a coma and with no blank spaces in between. For example, a file with a set of four coordinates will be as follows:
4,2
1,8
7,5
10,3
The path found by the program must start from 4,2 because it was the first coordinate in the list, and then it must continue to 7,5 because it is the closest coordinate to 4,2. Thus, the next coordinate must be 10,3 because it is the closest coordinate to 7,5. The final coordinate must be 1,8. The screen output should look like this: 4,2 --- 7,5 --- 10,3 --- 1,8. To run the program the user should type pathfinder <file_name>, where file_name is the file containing the coordinates.
这个是我们的一个project,但是我看不太懂,因为是菜鸟,求大神指点一二!谢谢啦
搜索更多相关主题的帖子: between starting numbers moving before 
2013-11-22 08:31
peach5460
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:武汉
等 级:贵宾
威 望:30
帖 子:2780
专家分:6060
注 册:2008-1-28
收藏
得分:10 
探路。写一个基于文本的程序,读取一组坐标的文本文件,并在屏幕上的输出路径,可以访问所有的坐标从文件中的第一个坐标,并在每一步移动到最近的坐标被访问过。在该文件中的坐标的最大数量为10。文本文件的格式由每行一个坐标的x,y点两个整数介于0和100由逗号分隔,之间没有空格。例如,一组四个坐标中的文件将是如下:
4,2
1,8
7,5
10,3
由程序找到的路径必须从4,2开始,因为它是列表中的第一个坐标,然后它必须继续,因为它是最接近的坐标为4,2 7,5 。因此,下一个坐标必须10,3 ,因为它是最接近的坐标为7,5 。最终的坐标必须是1,8 。屏幕输出看起来应该是这样的: 4,2 - 7,5 --- 10.3 --- 1,8 。要运行该程序,用户应输入探路者的删除<file_name> ,其中file_name是文件,其中包含的坐标。

谷歌翻译

我总觉得授人以鱼不如授人以渔...
可是总有些SB叫嚣着:要么给代码给答案,要么滚蛋...
虽然我知道不要跟SB一般见识,但是我真的没修炼到宠辱不惊...
2013-11-22 08:44
blueskiner
Rank: 8Rank: 8
等 级:蝙蝠侠
帖 子:227
专家分:707
注 册:2008-9-22
收藏
得分:10 
以下是引用peach5460在2013-11-22 08:44:01的发言:

探路。写一个基于文本的程序,读取一组坐标的文本文件,并在屏幕上的输出路径,可以访问所有的坐标从文件中的第一个坐标,并在每一步移动到最近的坐标被访问过。在该文件中的坐标的最大数量为10。文本文件的格式由每行一个坐标的x,y点两个整数介于0和100由逗号分隔,之间没有空格。例如,一组四个坐标中的文件将是如下:
4,2
1,8
7,5
10,3
由程序找到的路径必须从4,2开始,因为它是列表中的第一个坐标,然后它必须继续,因为它是最接近的坐标为4,2 7,5 。因此,下一个坐标必须10,3 ,因为它是最接近的坐标为7,5 。最终的坐标必须是1,8 。屏幕输出看起来应该是这样的: 4,2 - 7,5 --- 10.3 --- 1,8 。要运行该程序,用户应输入探路者的删除<file_name> ,其中file_name是文件,其中包含的坐标。

谷歌翻译

+1
2013-11-22 08:58
maxyu718
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-11-22
收藏
得分:0 
回复 2楼 peach5460
谢谢,我会google翻译,我想问这个具体应该怎么执行
2013-11-22 09:00
peach5460
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:武汉
等 级:贵宾
威 望:30
帖 子:2780
专家分:6060
注 册:2008-1-28
收藏
得分:0 
求代码?

我总觉得授人以鱼不如授人以渔...
可是总有些SB叫嚣着:要么给代码给答案,要么滚蛋...
虽然我知道不要跟SB一般见识,但是我真的没修炼到宠辱不惊...
2013-11-22 09:38
maxyu718
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-11-22
收藏
得分:0 
回复 5楼 peach5460
我是想了解一下这个project的思路,代码也可以。
2013-11-24 00:03
快速回复:Pathfinder的问题,请大神指点一二!
数据加载中...
 
   



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

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