登录
首页 » Windows开发 » 算法实现题2

算法实现题2

于 2022-11-12 发布 文件大小:65.09 kB
0 203
下载积分: 2 下载次数: 1

代码说明:

算法实现题2-1 输油管道问题 « 问题描述: 某石油公司计划建造一条由东向西的主输油管道。该管道要穿过一个有n 口油井的油 田。从每口油井都要有一条输油管道沿最短路经(或南或北)与主管道相连。如果给定n口油 井的位置,即它们的x 坐标(东西向)和y 坐标(南北向),应如何确定主管道的最优位置, 即使各油井到主管道之间的输油管道长度总和最小的位置?证明可在线性时间内确定主管道 的最优位置。 « 编程任务: 给定n 口油井的位置,编程计算各油井到主管道之间的输油管道最小长度总和。 « 数据输入: 由文件input.txt 提供输入数据。文件的第1 行是油井数n,1£ n£ 10000。接下来n 行是 油井的位置,每行2个整数x和y,-10000£ x,y£ 10000。 « 结果输出: 程序运行结束时,将计算结果输出到文件output.txt 中。文件的第1 行中的数是油井到 主管道之间的输油管道最小长度总和。 输入文件示例 输出文件示例 input.txt output.txt 5 1 2 2 2 1 3 3 -2 3 3 6

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Apriori算法
    应用背景用于数据挖掘的Apriori算法,PLSQL  ;易于测试,但是如果你用SQL不熟悉,很容易犯错误。不同的SQL,C++是容易 ;构建自己的类的测试关键技术C++,数据挖掘,类,结构, ;1;#包括; ; ;2;#包括; ; ;3;#包括 ;; ; ;4;#包括 ;; ; ;5;#包括 ;; ; ;6、使用和使用的名称空间和标准;7;与之和;8类。 ; ;Apriori  ; ;9;{和“;10。公众:和;11。 ; ; ; ;Apriori(size_t  ;是 ;= 0,int unsigned  ; ;MV = 0) ; ;12。和公司;及;{ &;{ &;13。 ; ; ; ; ; ; ; ;item_size  ;=  ; ; 是;14。 ; ; ; ; ; ; ; ;min_value  ;=  ;MV; ; ;15。和公司;&;&;};16。 ; ; ; ;/ / ~ apriori() { }; ; ; ;17。 ; ; ; ;  getitem()无效; ;
    2022-03-17 04:12:54下载
    积分:1
  • 用VC++编写的算3000的阶乘的源程序
    用VC++编写的算3000的阶乘的源程序-It is a source programme editted with VC to compute the factorial of 3000.
    2023-04-06 07:50:03下载
    积分:1
  • 这个是我的项目,主要是时间比较紧张,所以写得不是很好!碰撞部分用了像素和矩形碰撞!...
    这个是我的项目,主要是时间比较紧张,所以写得不是很好!碰撞部分用了像素和矩形碰撞!-This is my project, mainly relatively tense time, so writing is not very good! Collision part of the pixels and rectangular with a collision!
    2022-11-07 09:00:03下载
    积分:1
  • Is a financial management system, the program can run, please rest assured that...
    是一个财务管理系统,程序可以运行,请放心使用-Is a financial management system, the program can run, please rest assured that the use of
    2022-03-22 03:06:24下载
    积分:1
  • 24 hours learning how to use PHP MySQL and Apache
    24小时学会使用PHP MySQL and Apache-24 hours learning how to use PHP MySQL and Apache
    2023-04-05 06:20:04下载
    积分:1
  • 在命令将帮助你制作电话接待CA列表
    list of at commands which will help you to maker a call and recieve a ca-list of at commands which will help you to maker a call and recieve a call
    2022-08-12 12:30:13下载
    积分:1
  • AviToBmp项目
    这段代码可以将avi格式的视频转换成bmp序列,在c++中写。你可以打开它在vs2008中或更高版本。这是没有gui,控制台的代码,因此您必须初始化代码。感谢您下载,共享代码。
    2023-02-02 07:40:04下载
    积分:1
  • a)需求分析: 任务 :对一篇英文文章,统计各字符出现的次数,实现Huffman编码; 要求:输出每个字符出现的次数和编码,其中求最小权值要求用堆实现;...
    a)需求分析: 任务 :对一篇英文文章,统计各字符出现的次数,实现Huffman编码; 要求:输出每个字符出现的次数和编码,其中求最小权值要求用堆实现; b)概要设计: 本程序所使用的数据结构是树和线性表,所使用的算法主要有堆排序、赫夫曼算法。 -a) Requirements Analysis : Mandate : an article in English, statistics of the number of characters to achieve Huffman coding; Requirements : Every character in the output of the number and the code for which the minimum requirement of the right to use Heap; B) Summary of design : the procedures used by the data nodes the tree structure and linear form, the algorithm used by the main sculpture, in order Huffman algorithm.
    2022-03-06 12:21:16下载
    积分:1
  • 44B0X luxury version of NAND test code
    44B0X豪华版NAND 测试代码-44B0X luxury version of NAND test code
    2022-02-28 19:13:18下载
    积分:1
  • vb programming, computer graphics
    vb编程,计算机图形学-vb programming, computer graphics
    2022-01-24 16:18:18下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载