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

2.<b>75</b>

  • 源代码用动态规划算法计算序列关系个数 用关系"<"和"="将3个数a

    源代码\用动态规划算法计算序列关系个数 用关系"<"和"="将3个数a,b,c依次序排列时,有13种不同的序列关系: a=b=c,a=b<c,a<b=v,a<b<c,a<c<b a=c<b,b<a=c,b<a<c,b<c<a,b=c<a c<a=b,c<a<b,c<b<a 若要将n个数依序列,设计一个动态规划算法,计算出有多少种不同的序列关系, 要求算法只占用O(n),只耗时O(n*n).

    标签: lt 源代码 动态规划 序列

    上传时间: 2013-12-26

    上传用户:siguazgb

  • The government of a small but important country has decided that the alphabet needs to be streamline

    The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d . Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet. Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1. Definition

    标签: government streamline important alphabet

    上传时间: 2015-06-09

    上传用户:weixiao99

  • 上下文无关文法(Context-Free Grammar, CFG)是一个4元组G=(V, T, S, P)

    上下文无关文法(Context-Free Grammar, CFG)是一个4元组G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一组有限的产生式规则集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素称为非终结符,T的元素称为终结符,S是一个特殊的非终结符,称为文法开始符。 设G=(V, T, S, P)是一个CFG,则G产生的语言是所有可由G产生的字符串组成的集合,即L(G)={x∈T* | Sx}。一个语言L是上下文无关语言(Context-Free Language, CFL),当且仅当存在一个CFG G,使得L=L(G)。 *⇒ 例如,设文法G:S→AB A→aA|a B→bB|b 则L(G)={a^nb^m | n,m>=1} 其中非终结符都是大写字母,开始符都是S,终结符都是小写字母。

    标签: Context-Free Grammar CFG

    上传时间: 2013-12-10

    上传用户:gaojiao1999

  • 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

  • 离散实验 一个包的传递 用warshall

     实验源代码 //Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("请输入矩阵第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可传递闭包关系矩阵是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元关系的可传递闭包\n"); void warshall(int,int); int k , n; printf("请输入矩阵的行数 i: "); scanf("%d",&k); 四川大学实验报告 printf("请输入矩阵的列数 j: "); scanf("%d",&n); warshall(k,n); } 

    标签: warshall 离散 实验

    上传时间: 2016-06-27

    上传用户:梁雪文以

  • 道理特分解法

    #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

  • 小甲鱼 "零基础入门学习Python" 视频课程,97讲完整版

    000愉快的开始.mp4 33.6M2019-12-17 16:09 001我和Python的第一次亲密接触.mp4 29.4M2019-12-17 16:05 002用Python设计第一个游戏.mp4 51.3M2019-12-17 16:05 003小插曲之变量和字符串.mp4 90.9M2019-12-17 16:05 004改进我们的小游戏.mp4 115.9M2019-12-17 16:05 005闲聊之Python的数据类型.mp4 31.1M2019-12-17 16:05 006Pyhon之常用操作符.mp4 26.1M2019-12-17 16:05 007了不起的分支和循环.mp4 30.6M2019-12-17 16:05 008了不起的分支和循环2.mp4 23.3M2019-12-17 16:05 009了不起的分支和循环3.mp4 23.5M2019-12-17 16:05 010列表:一个打了激素的数组.mp4 23.2M2019-12-17 16:05 011列表:一个打了激素的数组2.mp4 22.1M2019-12-17 16:05 012列表:一个打了激素的数组3.mp4 36.2M2019-12-17 16:05 013元组:戴上了枷锁的列表.mp4 54.2M2019-12-17 16:05 014字符串:各种奇葩的内置方法.mp4 142.5M2019-12-17 16:05 015字符串:格式化.mp4 115.1M2019-12-17 16:05 016序列!序列!.mp4 81.1M2019-12-17 16:05 017函数:Python的乐高积木.mp4 25M2019-12-17 16:05 018函数:灵活即强大.mp4 33.7M2019-12-17 16:05 019函数:我的地盘听我的.mp4 33.1M2019-12-17 16:05 020函数:内嵌函数和闭包.mp4 35.5M2019-12-17 16:05 021函数:lambda表达式.mp4 28.9M2019-12-17 16:05 022函数:递归是神马.mp4 48.3M2019-12-17 16:05 023递归:这帮小兔崽子.mp4 39.5M2019-12-17 16:05 024递归:汉诺塔.mp4 28.8M2019-12-17 16:05 025字典:当索引不好用时.mp4 41.4M2019-12-17 16:05 026字典:当索引不好用时2.mp4 34.4M2019-12-17 16:05 027集合:在我的世界里,你就是唯一.mp4 19.4M2019-12-17 16:05 028文件:因为懂你,所以永恒.mp4 55.5M2019-12-17 16:05 029文件:一个任务.mp4 41.8M2019-12-17 16:05 030文件系统:介绍一个高大上的东西.mp4 80.3M2019-12-17 16:05 031永久存储:腌制一缸美味的泡菜.mp4 39.9M2019-12-17 16:05 032异常处理:你不可能总是对的.mp4 49M2019-12-17 16:05 033异常处理:你不可能总是对的2.mp4 34.9M2019-12-17 16:05 034丰富的else语句及简洁的with语句.mp4 24M2019-12-17 16:05 035图形用户界面入门:EasyGui.mp4 73.5M2019-12-17 16:05 036类和对象:给大家介绍对象.mp4 30.2M2019-12-17 16:05 037类和对象:面向对象编程.mp4 28.8M2019-12-17 16:05 038类和对象:继承.mp4 42.2M2019-12-17 16:05 039类和对象:拾遗.mp4 41.8M2019-12-17 16:05 040类和对象:一些相关的BIF.mp4 32.8M2019-12-17 16:05 041魔法方法:构造和析构.mp4 26.8M2019-12-17 16:05 042魔法方法:算术运算.mp4 30M2019-12-17 16:05 043魔法方法:算术运算2.mp4 31.8M2019-12-17 16:05 044魔法方法:简单定制.mp4 78.9M2019-12-17 16:05 045魔法方法:属性访问.mp4 42.9M2019-12-17 16:05 046魔法方法:描述符(Property的原理).mp4 42.4M2019-12-17 16:05 047魔法方法:定制序列.mp4 23M2019-12-17 16:05 048魔法方法:迭代器.mp4 32.9M2019-12-17 16:05 049乱入:生成器.mp4 33.3M2019-12-17 16:05 050模块:模块就是程序.mp4 25.6M2019-12-17 16:05 051模块:__name__='__main__'、搜索路径和包.mp4 29.6M2019-12-17 16:05 052模块:像个极客一样去思考.mp4 63M2019-12-17 16:05 053论一只爬虫的自我修养.mp4 48.1M2019-12-17 16:05 054论一只爬虫的自我修养2:实战.mp4 71.6M2019-12-17 16:05 055论一只爬虫的自我修养3:隐藏.mp4 54.8M2019-12-17 16:05 056轮一只爬虫的自我修养4:OOXX.mp4 94M2019-12-17 16:05 057论一只爬虫的自我修养5:正则表达式.mp4 58.6M2019-12-17 16:05 058论一只爬虫的自我修养6:正则表达式2.mp4 75.2M2019-12-17 16:05 059论一只爬虫的自我修养7:正则表达式3.mp4 57.2M2019-12-17 16:05 060论一只爬虫的自我修养8:正则表达式4.mp4 89.1M2019-12-17 16:05 061论一只爬虫的自我修养9:异常处理.mp4 32.1M2019-12-17 16:05 062论一只爬虫的自我修养10:安装Scrapy.mp4 58.7M2019-12-17 16:05 063论一只爬虫的自我修养11:Scrapy框架之初窥门径.mp4 156.5M2019-12-17 16:05 064GUI的终极选择:Tkinter.mp4 43.4M2019-12-17 16:05 065GUI的终极选择:Tkinter2.mp4 60.1M2019-12-17 16:05 066GUI的终极选择:Tkinter3.mp4 …………

    标签: 模具 钳工 问答

    上传时间: 2013-04-15

    上传用户:eeworm

  • 21世纪大学新型参考教材系列-集成电路B-荒井-159页-2.8M.pdf

    专辑类-电子基础类专辑-153册-2.20G 21世纪大学新型参考教材系列-集成电路B-荒井-159页-2.8M.pdf

    标签: 159 2.8 大学

    上传时间: 2013-05-16

    上传用户:pkkkkp

  • 里面有相应的hpunix(HP-UX hpl1000 B.11.00 U 9000/800 (tb)),linux(Red Hat Linux release 9 Kernel 2.4.20-8),w

    里面有相应的hpunix(HP-UX hpl1000 B.11.00 U 9000/800 (tb)),linux(Red Hat Linux release 9 Kernel 2.4.20-8),windows的头文件、库文件,还有相应的demo程序

    标签: release hpunix Kernel HP-UX

    上传时间: 2015-01-06

    上传用户:cursor