We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
标签: represented integers group items
上传时间: 2016-01-17
上传用户:jeffery
The XML Toolbox converts MATLAB data types (such as double, char, struct, complex, sparse, logical) of any level of nesting to XML format and vice versa. For example, >> project.name = MyProject >> project.id = 1234 >> project.param.a = 3.1415 >> project.param.b = 42 becomes with str=xml_format(project, off ) "<project> <name>MyProject</name> <id>1234</id> <param> <a>3.1415</a> <b>42</b> </param> </project>" On the other hand, if an XML string XStr is given, this can be converted easily to a MATLAB data type or structure V with the command V=xml_parse(XStr).
标签: converts Toolbox complex logical
上传时间: 2016-02-12
上传用户:a673761058
1.产生白噪声程序 编程产生一组正态分布的白噪声信号,它的均值和方差以及长度可随意调整。将产生的白噪声信号存入数据文件。 本程序算法用C++语言编写。首先用乘同余法产生均匀分布白噪声,再用变换抽样法转换为高斯分布白噪声。算法及程序实现叙述如下。 1) 设定x初值为11,A=179,长度WNlength,均值Average,方差Serror为用户输入的变量; 2) M =235,ζi= x/M; 3) 取ζi的小数部分再赋值给ζi+1,这就是均匀分布白噪声; 4) 利用公式 η1=Serror×(–2*logζ1)0.5×cos(2pζ2) +Average η2= Serror×(–2*logζ1)0.5×sin(2pζ2) +Average 计算得到均值和方差可任意调整的白噪声序列。式中 为均匀分布白噪声。
上传时间: 2016-10-19
上传用户:hanli8870
A network chatroom,a a project of database ,is highlighted by my teacher,which using the newest technics,such as ajax,struts 2 and so on,i think is very good for freshmen in web application
标签: highlighted chatroom database network
上传时间: 2017-09-19
上传用户:Pzj
function [alpha,N,U]=youxianchafen2(r1,r2,up,under,num,deta) %[alpha,N,U]=youxianchafen2(a,r1,r2,up,under,num,deta) %该函数用有限差分法求解有两种介质的正方形区域的二维拉普拉斯方程的数值解 %函数返回迭代因子、迭代次数以及迭代完成后所求区域内网格节点处的值 %a为正方形求解区域的边长 %r1,r2分别表示两种介质的电导率 %up,under分别为上下边界值 %num表示将区域每边的网格剖分个数 %deta为迭代过程中所允许的相对误差限 n=num+1; %每边节点数 U(n,n)=0; %节点处数值矩阵 N=0; %迭代次数初值 alpha=2/(1+sin(pi/num));%超松弛迭代因子 k=r1/r2; %两介质电导率之比 U(1,1:n)=up; %求解区域上边界第一类边界条件 U(n,1:n)=under; %求解区域下边界第一类边界条件 U(2:num,1)=0;U(2:num,n)=0; for i=2:num U(i,2:num)=up-(up-under)/num*(i-1);%采用线性赋值对上下边界之间的节点赋迭代初值 end G=1; while G>0 %迭代条件:不满足相对误差限要求的节点数目G不为零 Un=U; %完成第n次迭代后所有节点处的值 G=0; %每完成一次迭代将不满足相对误差限要求的节点数目归零 for j=1:n for i=2:num U1=U(i,j); %第n次迭代时网格节点处的值 if j==1 %第n+1次迭代左边界第二类边界条件 U(i,j)=1/4*(2*U(i,j+1)+U(i-1,j)+U(i+1,j)); end if (j>1)&&(j U2=1/4*(U(i,j+1)+ U(i-1,j)+ U(i,j-1)+ U(i+1,j)); U(i,j)=U1+alpha*(U2-U1); %引入超松弛迭代因子后的网格节点处的值 end if i==n+1-j %第n+1次迭代两介质分界面(与网格对角线重合)第二类边界条件 U(i,j)=1/4*(2/(1+k)*(U(i,j+1)+U(i+1,j))+2*k/(1+k)*(U(i-1,j)+U(i,j-1))); end if j==n %第n+1次迭代右边界第二类边界条件 U(i,n)=1/4*(2*U(i,j-1)+U(i-1,j)+U(i+1,j)); end end end N=N+1 %显示迭代次数 Un1=U; %完成第n+1次迭代后所有节点处的值 err=abs((Un1-Un)./Un1);%第n+1次迭代与第n次迭代所有节点值的相对误差 err(1,1:n)=0; %上边界节点相对误差置零 err(n,1:n)=0; %下边界节点相对误差置零 G=sum(sum(err>deta))%显示每次迭代后不满足相对误差限要求的节点数目G end
标签: 有限差分
上传时间: 2018-07-13
上传用户:Kemin
LabView实用技巧系列视频 -LabVIEW2009-2010破解工具 -LabView资料.zip 116.4MLabVIEW与机器人科技创新活动.zip 1.63GLabVIEW高级程序设计.zip 335.1MLabVIEW高级编程与虚拟仪器工程应用.zip 122.2MLabView宝典.zip 1.02GLabVIEW8.6中文版讲解视频(无声音).rar 264.9MLabVIEW2010.rar 863.7MLabVIEW 程序设计基础与提高.zip 544.5M清华版labview教程12.25.rar 1MVB6_OPC_Client.rar 17KB9.VI的可重入性.avi 68.5M8.控件的输入与输出转换.avi 55.2M7.VI本地化.avi 72.2M6.条件结构的巧用.avi 133.6M5.数组和簇.avi 131.1M4.程序结构中的分支结构和顺序结构.avi 69.8M3.程序结构中的循环结构.avi 88.2M23.制作不规则图形的子VI图标.avi 52.7M22.界面设计技巧2.avi 57.6M21.界面设计技巧1.avi 86.3M20.用户界面设计5.avi 71.4M2.多态VI的创建.avi 82.8M19.用户界面设计4.avi 41.3M18.用户界面设计3.avi 51.2M17.用户界面设计2.avi 56.3M16.用户界面设计1.avi 36.1M15.波形图表、波形图和XY图表.avi 63.5M14.列表框控件添加图标.avi 84.9M13.在文件夹下直接创建新的VI.avi 72.5M12.控件板和函数板的使用.avi 80.5M11.自定义控件.avi 44.2M10.VI属性(下).avi 95.7M10.VI属性(上).avi 85.3M1.VI的创建.avi 68.3M
上传时间: 2022-06-14
上传用户:
书 名:Programming Windows程式开发设计指南 出版日期:2000/6/2 书 号:957-8239-73-4 I S B N:957-8239-73-4 原 作 者:Charles Petzold 译 者:余孟学
标签: 8239 Programming 957 Windows
上传时间: 2015-04-26
上传用户:xinyuzhiqiwuwu
给出Henon的模型x(i+1)=1+y(i)-a*x(i)^2 y(i+1)=b*x(i)
上传时间: 2013-12-18
上传用户:徐孺
实现最优二叉树的构造;在此基础上完成哈夫曼编码器与译码器。 假设报文中只会出现如下表所示的字符: 字符 A B C D E F G H I J K L M N 频度 186 64 13 22 32 103 21 15 47 57 1 5 32 20 57 字符 O P Q R S T U V W X Y Z , . 频度 63 15 1 48 51 80 23 8 18 1 16 1 6 2 要求完成的系统应具备如下的功能: 1.初始化。从终端(文件)读入字符集的数据信息,。建立哈夫曼树。 2.编码:利用已建好的哈夫曼树对明文文件进行编码,并存入目标文件(哈夫曼码文件)。 3.译码:利用已建好的哈夫曼树对目标文件(哈夫曼码文件)进行编码,并存入指定的明文文件。 4.输出哈夫曼编码文件:输出每一个字符的哈夫曼编码。
上传时间: 2014-11-23
上传用户:shanml
车牌定位---VC++源代码程序 1.24位真彩色->256色灰度图。 2.预处理:中值滤波。 3.二值化:用一个初始阈值T对图像A进行二值化得到二值化图像B。 初始阈值T的确定方法是:选择阈值T=Gmax-(Gmax-Gmin)/3,Gmax和Gmin分别是最高、最低灰度值。 该阈值对不同牌照有一定的适应性,能够保证背景基本被置为0,以突出牌照区域。 4.削弱背景干扰。对图像B做简单的相邻像素灰度值相减,得到新的图像G,即Gi,j=|Pi,j-Pi,j-1|i=0,1,…,439 j=0,1,…,639Gi,0=Pi,0,左边缘直接赋值,不会影响整体效果。 5.用自定义模板进行中值滤波 区域灰度基本被赋值为0。考虑到文字是由许多短竖线组成,而背景噪声有一大部分是孤立噪声,用模板(1,1,1,1,1)T对G进行中值滤波,能够得到除掉了大部分干扰的图像C。 6.牌照搜索:利用水平投影法检测车牌水平位置,利用垂直投影法检测车牌垂直位置。 7.区域裁剪,截取车牌图像。
上传时间: 2013-11-26
上传用户:懒龙1988