虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

Multiple-Input

  • Ex3-23 亲兄弟问题 « 问题描述: 给定n 个整数0 1 1 , , , n- a a  a 组成的序列。序列中元素i a 的亲兄弟元素k a 定义为: min{

    Ex3-23 亲兄弟问题 « 问题描述: 给定n 个整数0 1 1 , , , n- a a  a 组成的序列。序列中元素i a 的亲兄弟元素k a 定义为: min{ | } k i j n j j i a = a a ³ a < < 。 亲兄弟问题要求给定序列中每个元素的亲兄弟元素的位置。元素i a 的亲兄弟元素为k a 时,称k 为元素i a 的亲兄弟元素的位置。当元素i a 没有亲兄弟元素时,约定其亲兄弟元素 的位置为-1。 例如,当n=10,整数序列为6,1,4,3,6,2,4,7,3,5 时,相应的亲兄弟元素位 置序列为:4,2,4,4,7,6,7,-1,9,-1。 « 编程任务: 对于给定的n个整数0 1 1 , , , n- a a  a 组成的序列,试用抽象数据类型栈,设计一个O(n) 时间算法,计算相应的亲兄弟元素位置序列。 « 数据输入: 由文件input.txt提供输入数据。文件的第1 行有1 个正整数n,表示给定给n个整数。 第2 行是0 1 1 , , , n- a a  a 。 « 结果输出: 程序运行结束时,将计算出的与给定序列相应的亲兄弟元素位置序列输出到output.txt 中。 输入文件示例 输出文件示例 input.txt 10 4 2 4 4 7 6 7 -1 9 -1 output.txt 6 1 4 3 6 2 4 7 3 5

    标签: 61516 laquo min 序列

    上传时间: 2013-12-17

    上传用户:shizhanincc

  • Ex8-4 汇点问题 « 问题描述: 采用邻接矩阵表示一个具有n 个顶点的图时

    Ex8-4 汇点问题 « 问题描述: 采用邻接矩阵表示一个具有n 个顶点的图时,大多数关于图的算法时间复杂性为 O(n2 ),但也有例外。例如,即使采用邻接矩阵表示一个有向图G,确定G 是否含有一个 汇(即入度为n-1,出度为0 的顶点),只需要O(n)计算时间。试写出其算法。 « 编程任务: 对于给定的有n个顶点的图G 的邻接矩阵,各顶点依次编号为1,2,…,n。试设计一 个O(n)时间算法,计算图G 的汇点。 « 数据输入: 由文件input.txt提供输入数据。文件的第1 行有1 个正整数n,表示图G 中顶点个数。 第2 行起每行n个数,共n行,给出图G 的邻接矩阵。 « 结果输出: 程序运行结束时,将计算出的汇点编号输出到output.txt中。当图G 没有汇点时输出0。 输入文件示例 输出文件示例 input.txt 5 0 0 1 1 1 1 0 1 1 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 0 output.txt 3

    标签: laquo Ex 矩阵表示

    上传时间: 2013-12-25

    上传用户:yyyyyyyyyy

  • 算法实现题1-5 最大间隙问题 « 问题描述: 最大间隙问题:给定n 个实数x , , xn 1 2 

    算法实现题1-5 最大间隙问题 « 问题描述: 最大间隙问题:给定n 个实数x , , xn 1 2  ,求这n 个数在实轴上相邻2 个数之间的最 大差值。假设对任何实数的下取整函数耗时O(1),设计解最大间隙问题的线性时间算法。 « 编程任务: 对于给定的n 个实数n x , x , , x 1 2  ,编程计算它们的最大间隙。 « 数据输入: 输入数据由文件名为input.txt的文本文件提供。文件的第1 行有1 个正整数n。接下来 的1 行中有n个实数n x , x , , x 1 2  。 « 结果输出: 程序运行结束时,将找到的最大间隙输出到文件output.txt中。 输入文件示例 输出文件示例 input.txt 5 2.3 3.1 7.5 1.5 6.3 output.txt 3.2

    标签: laquo 61516 xn 算法

    上传时间: 2016-05-28

    上传用户:咔乐坞

  • Ex4-22 单射函数问题 « 问题描述: 设函数f将点集S = {0,1, , n -1}映射为f (S) = { f (i) | iÎ S} Í

    Ex4-22 单射函数问题 « 问题描述: 设函数f将点集S = {0,1, , n -1}映射为f (S) = { f (i) | iÎ S} Í S 。单射函数问题要 从S中选取最大子集X Í S 使f (X )是单射函数。 例如,当n=7, f (S) = {1,0,0,2,2,3,6} Í S 时, X = {0,1,6} Í S 是所求的最大子集。 « 编程任务: 对于给定的点集S = {0,1, , n -1}上函数f,试用抽象数据类型队列,设计一个O(n)时 间算法,计算f的最大单射子集。 « 数据输入: 由文件input.txt 提供输入数据。文件的第1 行有1 个正整数n,表示给定的点集 S = {0,1, , n -1}。第2 行是f (i)的值,0 £ i < n。 « 结果输出: 程序运行结束时,将计算出的f的最大单射子集的大小输出到output.txt中。 输入文件示例 输出文件示例 input.txt 7 1 0 0 2 2 3 6 output.txt 3

    标签: Iacute 61516 laquo Icirc

    上传时间: 2016-05-28

    上传用户:tyler

  • 不用说的好

    不用说的好,我们室主任开发的Photonics cyrestal band gap计算Fortran代码。注意不要忘了input文本。

    标签:

    上传时间: 2014-01-23

    上传用户:jcljkh

  • Tasks Read the textbook about the details of Vigenére Cipher. Implement the algorithm by C or C++.

    Tasks Read the textbook about the details of Vigenére Cipher. Implement the algorithm by C or C++. Requirements You do this lab in a group of two students. Your program should have input and output as follows: csci>a.out --> Please input the key: receptive --> Please input the plain text: wearediscoveredsaveyourself --> The cipher text is : nicvtwqngfzgvtwavzvcqyglmgj -->The original message is: wearediscoveredsaveyourself • You should test your program with several runs.

    标签: the Implement algorithm textbook

    上传时间: 2013-12-21

    上传用户:bruce5996

  • % DYNMODES calculates ocean dynamic vertical modes % taking a column vector of Brunt-Vaisala values

    % DYNMODES calculates ocean dynamic vertical modes % taking a column vector of Brunt-Vaisala values (Nsq) at % different pressures (p) and calculating some number of % dynamic modes (nmodes). % Note: The input pressures need not be uniformly spaced, % and the deepest pressure is assumed to be the bottom.

    标签: Brunt-Vaisala calculates DYNMODES vertical

    上传时间: 2013-12-06

    上传用户:busterman

  • This guide reviews the rules and syntax of the principle commands that comprise C and its object-ori

    This guide reviews the rules and syntax of the principle commands that comprise C and its object-oriented cousin, C++. The reference consists of 19 chapters that define operators and the standard input/output, string, character, and more.

    标签: object-ori and principle the

    上传时间: 2014-01-15

    上传用户:ve3344

  • The CoinUtils project is a collection of open-source utilities developed and used by a variety of ot

    The CoinUtils project is a collection of open-source utilities developed and used by a variety of other projects in the COIN-OR repository. The project includes classes for storing and manipulating sparse matrices and vectors, performing matrix factorization, parsing input files in standard formats, building representations of mathematical programs, comparing floating point numbers with a tolerance, performing simple presolve operations, and warm starting algorithms for mathematical programs, among others.

    标签: open-source collection CoinUtils developed

    上传时间: 2013-12-19

    上传用户:xmsmh

  • Description   为了宣传本次“网宿科技杯”厦门大学第五届程序设计竞赛

    Description   为了宣传本次“网宿科技杯”厦门大学第五届程序设计竞赛,系里面做了两张精美的海报。经过了精确的计算,为了达到最佳美观效果,每张海报都有自己最佳的粘贴位置。但是现在问题是,如果两张海报都要求贴在最佳位置时,很有可能有部分地方会重叠在一起。现在您来判断一下这两张海报是否重叠。 Input   输入包含两行,每一行有四个整数来描述这个海报的最佳粘贴位置,X,Y,W,H(-10000<= X,Y <= 10000)(0 < W, H <= 10000),X,Y表示海报左下角的坐标,W,H分别表示宽度和高度。 Output   输出"Yes"表示两张海报互相重叠(表示存在一个面积大于0的公共区域),否则输出"No"。(不包含引号,注意大小写) Sample Input -10 -10 20 30 0 0 30 20 Sample Output Yes

    标签: Description 大学 程序设计 竞赛

    上传时间: 2016-06-26

    上传用户:gxf2016