在一个划分成网格的操场上,n个士兵散乱地站在网格点上。网格点由整数坐标(x,y)表示。士兵们可以沿网格边上、下、左、右移动一步,但在同一时刻任一网格点上只能有一名士兵。按照军官的命令,士兵们要整齐地列成一个水平队列,即排列成(x,y),(x+1,y),…,(x+n-1,y)。如何选择x 和y的值才能使士兵们以最少的总移动步数排成一列。 实验任务:计算使所有士兵排成一行需要的最少移动步数。
上传时间: 2016-10-10
上传用户:leixinzhuo
开机时,显示12:00:00的时间开始计时; P0.0/AD0控制“秒”的调整,每按一次加1秒; P0.1/AD1控制“分”的调整,每按一次加1分; P0.2/AD2控制“时”的调整,每按一次加1个小时;
标签: 开机
上传时间: 2014-01-25
上传用户:colinal
AODV的一些心得,希望有帮助1 希望有帮助1
标签: AODV
上传时间: 2016-11-24
上传用户:hustfanenze
标准的遗传算法代码,下面是程序:function y=fitness(chrom,p,aim) global P_cross P_mutation [Popsize len]=size(chrom) fitness_gene=zeros(Popsize,1) in_he=zeros(4,1) out_he=zeros(4,1) in_out=0 out_out=0
上传时间: 2013-12-08
上传用户:pkkkkp
MATLAB Code for Optimal Quincunx Filter Bank Design Yi Chen July 17, 2006 This file introduces the MATLAB code that implements the two algorithms (i.e., Algorithms 1 and 2 in [1], or Algorithms 4.1 and 4.2 in [2]) used for the construction of quincunx filter banks with perfect reconstruction, linear phase, high coding gain, certain vanishing moments properties, and good frequency selectivity. The code can be used to design quincunx filter banks with two, three, or four lifting steps. The SeDuMi Matlab toolbox [3] is used to solve the second-order cone programming subproblems in the two algorithms, and must be installed in order for this code to work.
标签: introduces Quincunx Optimal MATLAB
上传时间: 2014-01-15
上传用户:cc1
程序在主程序中没有连续改变小灯的状态,而在开始运行时将其关闭,延时后点亮。实验现象是一只小灯不断闪烁,这是因为程序中启动了看门狗,看门狗时间长度为1 秒,如果1 秒内没有复位看门狗的话,系统将复位。系统复位后再次开启看门狗,1 秒后复位。
上传时间: 2014-12-07
上传用户:libenshu01
//Euler 函数前n项和 /* phi(n) 为n的Euler原函数 if( (n/p) % i == 0 ) phi(n)=phi(n/p)*i else phi(n)=phi(n/p)*(i-1) 对于约数:divnum 如果i|pr[j] 那么 divnum[i*pr[j]]=divsum[i]/(e[i]+1)*(e[i]+2) //最小素因子次数加1 否则 divnum[i*pr[j]]=divnum[i]*divnum[pr[j]] //满足积性函数条件 对于素因子的幂次 e[i] 如果i|pr[j] e[i*pr[j]]=e[i]+1 //最小素因子次数加1 否则 e[i*pr[j]]=1 //pr[j]为1次 对于本题: 1. 筛素数的时候首先会判断i是否是素数。 根据定义,当 x 是素数时 phi[x] = x-1 因此这里我们可以直接写上 phi[i] = i-1 2. 接着我们会看prime[j]是否是i的约数 如果是,那么根据上述推导,我们有:phi[ i * prime[j] ] = phi[i] * prime[j] 否则 phi[ i * prime[j] ] = phi[i] * (prime[j]-1) (其实这里prime[j]-1就是phi[prime[j]],利用了欧拉函数的积性) 经过以上改良,在筛完素数后,我们就计算出了phi[]的所有值。 我们求出phi[]的前缀和 */
上传时间: 2016-12-31
上传用户:gyq
编写具有如下函数原型的递归与非递归两种函数f,负责判断数组a的前n个元素是否从大到小完全有序了,是则返回true,否则返回false。并编制主函数对它们进行调用,以验证其正确性。 bool f(int a[], int n) 提示: (1)非递归函数中只需逐对地判断各a[i]与a[i+1]是否都已从大到小有序排列(i = 0,1,…,n-2)。 (2)递归函数中将问题分解处理为:若n=1(即只有1个元素时)则返回true而递归出口;n>1时,若最后一对元素不顺序则返回false,否则进行递归调用(传去实参a与 n-1,去判断前n-1个元素的顺序性),并返回递归调用的结果(与前n-1个元素的是否顺序性相同)。
上传时间: 2017-01-02
上传用户:清风冷雨
PL0 C语言版本 //A.2 C 版 本 /*编译和运行环境: *1Visual C++6.0,VisualC++.NET and Visual C++.NET 2003 *WinNT, Win 200, WinXP and Win2003 *2 gcc version 3.3.2 20031022(Red Hat Linux 3.3.2-1) *Redhat Fedora core 1 *Intel 32 platform *使用方法: *运行后输入PL/0 源程序文件名 *回答是否输出虚拟机代码 *回答是否输出名字表 *fa.tmp 输出虚拟机代码 *fa1.tmp 输出源文件及其各行对应的首地址 *fa2.tmp 输出结果 *fas.tmp 输出名字表 */
上传时间: 2013-12-22
上传用户:远远ssad
MPI stands for the Message Passing Interface. Written by the MPI Forum (a large committee comprising of a cross-section between industry and research representatives), MPI is a standardized API typically used for parallel and/or distributed computing. The MPI standard is comprised of 2 documents: MPI-1 (published in 1994) and MPI-2 (published in 1996). MPI-2 is, for the most part, additions and extensions to the original MPI-1 specification. The MPI-1 and MPI-2 documents can be downloaded from the official MPI Forum web site: http://www.mpi-forum.org/. Open MPI is an open source, freely available implementation of both the MPI-1 and MPI-2 documents. The Open MPI software achieves high performance the Open MPI project is quite receptive to community input.
标签: comprising MPI Interface committee
上传时间: 2013-12-22
上传用户:爺的气质