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

算法<b>库</b>

  • We have a group of N items (represented by integers from 1 to N), and we know that there is some tot

    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)

    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

  • 汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation

    汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation eg. if n = 2 A→B A→C B→C if n = 3 A→C A→B C→B A→C B→A B→C A→C

    标签: the animation Simulate movement

    上传时间: 2017-02-11

    上传用户:waizhang

  • 将魔王的语言抽象为人类的语言:魔王语言由以下两种规则由人的语言逐步抽象上去的:α-〉β1β2β3…βm ;θδ1δ2…-〉θδnθδn-1…θδ1 设大写字母表示魔王的语言

    将魔王的语言抽象为人类的语言:魔王语言由以下两种规则由人的语言逐步抽象上去的:α-〉β1β2β3…βm ;θδ1δ2…-〉θδnθδn-1…θδ1 设大写字母表示魔王的语言,小写字母表示人的语言B-〉tAdA,A-〉sae,eg:B(ehnxgz)B解释为tsaedsaeezegexenehetsaedsae对应的话是:“天上一只鹅地上一只鹅鹅追鹅赶鹅下鹅蛋鹅恨鹅天上一只鹅地上一只鹅”。(t-天d-地s-上a-一只e-鹅z-追g-赶x-下n-蛋h-恨)

    标签: 语言 抽象 字母

    上传时间: 2013-12-19

    上传用户:aix008

  • 本代码为编码开关代码

    本代码为编码开关代码,编码开关也就是数字音响中的 360度旋转的数字音量以及显示器上用的(单键飞梭开 关)等类似鼠标滚轮的手动计数输入设备。 我使用的编码开关为5个引脚的,其中2个引脚为按下 转轮开关(也就相当于鼠标中键)。另外3个引脚用来 检测旋转方向以及旋转步数的检测端。引脚分别为a,b,c b接地a,c分别接到P2.0和P2.1口并分别接两个10K上拉 电阻,并且a,c需要分别对地接一个104的电容,否则 因为编码开关的触点抖动会引起轻微误动作。本程序不 使用定时器,不占用中断,不使用延时代码,并对每个 细分步数进行判断,避免一切误动作,性能超级稳定。 我使用的编码器是APLS的EC11B可以参照附件的时序图 编码器控制流水灯最能说明问题,下面是以一段流水 灯来演示。

    标签: 代码 编码开关

    上传时间: 2017-07-03

    上传用户:gaojiao1999

  • 【问题描述】 在一个N*N的点阵中

    【问题描述】 在一个N*N的点阵中,如N=4,你现在站在(1,1),出口在(4,4)。你可以通过上、下、左、右四种移动方法,在迷宫内行走,但是同一个位置不可以访问两次,亦不可以越界。表格最上面的一行加黑数字A[1..4]分别表示迷宫第I列中需要访问并仅可以访问的格子数。右边一行加下划线数字B[1..4]则表示迷宫第I行需要访问并仅可以访问的格子数。如图中带括号红色数字就是一条符合条件的路线。 给定N,A[1..N] B[1..N]。输出一条符合条件的路线,若无解,输出NO ANSWER。(使用U,D,L,R分别表示上、下、左、右。) 2 2 1 2 (4,4) 1 (2,3) (3,3) (4,3) 3 (1,2) (2,2) 2 (1,1) 1 【输入格式】 第一行是数m (n < 6 )。第二行有n个数,表示a[1]..a[n]。第三行有n个数,表示b[1]..b[n]。 【输出格式】 仅有一行。若有解则输出一条可行路线,否则输出“NO ANSWER”。

    标签: 点阵

    上传时间: 2014-06-21

    上传用户:llandlu

  • 道理特分解法

    #include "iostream" using namespace std; class Matrix { private: double** A; //矩阵A double *b; //向量b public: int size; Matrix(int ); ~Matrix(); friend double* Dooli(Matrix& ); void Input(); void Disp(); }; Matrix::Matrix(int x) { size=x; //为向量b分配空间并初始化为0 b=new double [x]; for(int j=0;j<x;j++) b[j]=0; //为向量A分配空间并初始化为0 A=new double* [x]; for(int i=0;i<x;i++) A[i]=new double [x]; for(int m=0;m<x;m++) for(int n=0;n<x;n++) A[m][n]=0; } Matrix::~Matrix() { cout<<"正在析构中~~~~"<<endl; delete b; for(int i=0;i<size;i++) delete A[i]; delete A; } void Matrix::Disp() { for(int i=0;i<size;i++) { for(int j=0;j<size;j++) cout<<A[i][j]<<" "; cout<<endl; } } void Matrix::Input() { cout<<"请输入A:"<<endl; for(int i=0;i<size;i++) for(int j=0;j<size;j++){ cout<<"第"<<i+1<<"行"<<"第"<<j+1<<"列:"<<endl; cin>>A[i][j]; } cout<<"请输入b:"<<endl; for(int j=0;j<size;j++){ cout<<"第"<<j+1<<"个:"<<endl; cin>>b[j]; } } double* Dooli(Matrix& A) { double *Xn=new double [A.size]; Matrix L(A.size),U(A.size); //分别求得U,L的第一行与第一列 for(int i=0;i<A.size;i++) U.A[0][i]=A.A[0][i]; for(int j=1;j<A.size;j++) L.A[j][0]=A.A[j][0]/U.A[0][0]; //分别求得U,L的第r行,第r列 double temp1=0,temp2=0; for(int r=1;r<A.size;r++){ //U for(int i=r;i<A.size;i++){ for(int k=0;k<r-1;k++) temp1=temp1+L.A[r][k]*U.A[k][i]; U.A[r][i]=A.A[r][i]-temp1; } //L for(int i=r+1;i<A.size;i++){ for(int k=0;k<r-1;k++) temp2=temp2+L.A[i][k]*U.A[k][r]; L.A[i][r]=(A.A[i][r]-temp2)/U.A[r][r]; } } cout<<"计算U得:"<<endl; U.Disp(); cout<<"计算L的:"<<endl; L.Disp(); double *Y=new double [A.size]; Y[0]=A.b[0]; for(int i=1;i<A.size;i++ ){ double temp3=0; for(int k=0;k<i-1;k++) temp3=temp3+L.A[i][k]*Y[k]; Y[i]=A.b[i]-temp3; } Xn[A.size-1]=Y[A.size-1]/U.A[A.size-1][A.size-1]; for(int i=A.size-1;i>=0;i--){ double temp4=0; for(int k=i+1;k<A.size;k++) temp4=temp4+U.A[i][k]*Xn[k]; Xn[i]=(Y[i]-temp4)/U.A[i][i]; } return Xn; } int main() { Matrix B(4); B.Input(); double *X; X=Dooli(B); cout<<"~~~~解得:"<<endl; for(int i=0;i<B.size;i++) cout<<"X["<<i<<"]:"<<X[i]<<" "; cout<<endl<<"呵呵呵呵呵"; return 0; } 

    标签: 道理特分解法

    上传时间: 2018-05-20

    上传用户:Aa123456789

  • VIP专区-嵌入式/单片机编程源码精选合集系列(101)

    VIP专区-嵌入式/单片机编程源码精选合集系列(101)资源包含以下内容:1. TMS320C54x interrupt.2. C54 instruction.3. 电闹钟的设计与制作 电闹钟的设计与制作电闹钟的设计与制作.4. STR71x的BSPI与M25P10-A串行闪存通信.5. DN503 -- SPI Access (Rev. A).6. 这个rt12864的驱动是我自己摸索了很久才做出来的,因为这块液晶的真正权威的能参考的绘图资料真的是太少了,所以我上传上来,算是做点贡献吧.7. GBK点阵字体的显示.8. PCI接口产品中桥芯片PLX6000、PLX8000、PLX9000、PLXsrv系列的驱动模块源代码.9. PCI接口产品中桥芯片PLX6000、PLX8000、PLX9000和PLXsrv驱动模块源码.10. 很好的资料,很好的芯片,做电机驱动用得到的.11. 红外成像跟踪处理器的研制.12. 51单片机上模拟i2c传输的程序.13. 一个类STL的多平台可移植的算法容器库,主要用于嵌入式系统编程时的内存管理等方面.14. 红外遥控键值解码1602液晶显示 红外遥控器键值如下: 10 03 01 06 09 1D 1F 0D 19 1B 11 15 17 12 16 4C 40 48 04 00 02.15. AT51单片机与蜂鸣器奏乐连接演奏(生日快乐).16. 一个用西门子200编的勾数计数程序.17. This guide describes Freescale’s BeeKit Wireless Connectivity Toolkit configuration tool used for Zi.18. This manual describes Freescale’s IEEE™ 802.15.4 Standard compliant MAC/PHY software. The Frees.19. 闻亭TDS560仿真器中的驱动TEST文件夹.20. plc文件.21. atmega8+vs1003+sd卡MP3.22. 康芯公司GWDBVP开发板的原理图.23. ESS3890+SL原代码(1*16内存).24. 嵌入式系统相关:周立功EasyArm2131开发板原理图的真正Protel版本(绝非无耻的PDF版本!).25. Nios II 处理器中文小册子(altera) NIOS开发板APEX20K版数据手册 niosii资料-软件开发文档 北航NIOS教程.26. C语言51单片机程序.27. 基于51单片机的控制的红外线通信.28. 基于51单片机控制电机或舵机等.29. 智能电加热温控系统的研制.kdh 整体说明与设计.30. 8255可编程并行扩展接口位控功能的应用.caj.31. 2401 接受程序.32. 基于ARM7 LPC2114学习板程序。学习板提供的是ADS源码.33. 提供收音模块的操作代码.可以操作各种收音模块.34. 嵌入式系统设计师大纲 很辛苦找到的东东.35. nucleus 2006 source code.36. 芯片测试讲义.37. i2c存储体系在arm9平台上实现的资料.38. 一种新型的独立CAN通信控制器MCP2515;给出其在CAN总线系统智能节点中的一个应用实例.39. 该书是网卡芯片AMD973的开发手册,专用于常用网卡芯片开始使用,驱动程序员需要..40. 嵌入式常用的字库工具,可以由BMP文件生成字库,也可根据TEXT生成字库,也可生成字模.总之功能强大,要不也不叫完美版了!.

    标签: 天线

    上传时间: 2013-07-04

    上传用户:eeworm

  • 一个简单好用的B+树算法实现

    一个简单好用的B+树算法实现

    标签: 算法

    上传时间: 2015-01-04

    上传用户:缥缈

  • 一个用Basic实现的B-Tree算法

    一个用Basic实现的B-Tree算法

    标签: B-Tree Basic 算法

    上传时间: 2013-12-30

    上传用户:ccclll