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),其中,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 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
实验源代码 //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); }
上传时间: 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
AT89C51设计LCD1602显示DS1302实时日历时钟毕业论文文档+软件源码,单片机LCD毕业设计,有代码、仿真电路、设计报告,仿真使用的是proteus仿真,可直接加载HEX文件运行. 此次设计的要求是通过LCD与单片机的连接模块能够显示数字(如时间)、字符(如英文)和图形等,这就需要专门的时钟芯片-----DS1302。 DS1302是一种高性能、低功耗、带RAM的实时时钟芯片,它能够对时,分,秒进行精确计时,它与单片机的接口使用同步串行通信,仅用3条线与之相连接,就可以实现MCS-51单片机对其进行读写操作,把读出的时间数据送到LCD1602上显示。程序运行时,必须先对LM044L进行初始设置,然后,通过单片机从DS1302中获取时间并通过LCD1602显示。同时,进行循环赋值,使LCD动态显示当前的时间。关键字:AT89C51、DS1302,LCD1602显示器 一.设计任务和要求 1. 利用DS1302实现年月日时分秒,并用LCD显示。2. 通过LCD模块与单片机的接口,能显示数字(如时间)、字符(如英文)。3. 硬件设计部分,根据设计的任务选定合适的单片机,根据控制对象设计接口电路。设计的单元电路必须有工作原理,器件的作用,分析和计算过程;4. 软件设计部分,根据电路工作过程,画出软件流程图,根据流程图编写相应的程序,进行调试并打印程序清单;5.原理图设计部分,根据所确定的设计电路,利用Proteus工具软件绘制电路原理图。6计算说明书部分包括方案论证报告打印版或手写版,程序流程图具体程序等7. 图纸部分包括具体电路原理图打印版8. 设计要求还包括利用一天时间进行资料查阅与学习讨论,利用5天时间在实验室进行分散设计,最后三天编写报告。最后一天进行成果验收。
上传时间: 2021-12-08
上传用户:
VIP专区-嵌入式/单片机编程源码精选合集系列(136)资源包含以下内容:1. 51嵌入式系统程.2. 源码阅读 Code Reading: The Open Source rspective By Diomidis Spinellis.3. 具体功能质量高得到以后可以到我的博客去看看你能收获很多.4. 91c111芯片的网络模块的原理图以及和ep1c6fpga连线相关的例子程序.5. spce061单片机的一些程序!C语言和汇编语言都有.6. EBD9260开发板的测试程序.7. 自己编写的复合开关控制程序希望对大家有所帮助.8. 程序主要模拟了系统文件管理的功能.9. matlab两个GUI之间参数传递的方法.10. C programming guide for embedded critical application..11. 是很好的nios入门教材.12. 广东肇庆风华新谷微电子有限公司各种表贴二极管资料手册:FH1N4001 FH1N4002 FH1N4004 FH1N4007 FH1N5817 FH1N5818 H1N5819 FH1N5822 FH.13. 是课本教材。电子档图书。pdf格式的。费了很大的劲.14. 表贴电容元件参数手册:105 个PDF文件.15. plx9054图像卡驱动程序.16. ds3231与meg128模拟i2c总线通信.17. 嵌入式WinCE平台下的USB视频程序.18. DS1302实时时钟芯片驱动.19. 较详细的说明了ad转换的程序.20. 840D数控机床PLC控制程序.用于数控外铣加工中心的开发..21. vb开发200例.22. 这是5按键读U盘MP3的程序.采用ATmega32芯片..23. 这是从SD卡读MP3的C语言程序,MCU采用ATMEGA32芯片..24. s5,s7用link与软PLC通信的例程.25. 该源码实现单片机域计算机的通信.26. 华为内部编程规范和范例.27. μC/GUI是一种基于嵌入式应用的通用图形接口软件.28. 2412 LCD 画点画线画图显示字函数2 412 LCD 画点画线画图显示字函数.29. ZigBee协议栈的精简源码,测试通过.30. 文章基于ZigBee技术的矿井工作面移动式瓦斯监测.31. arm嵌入式开发实例.32. ppc 8245 可编译bsp 包括 uart.33. 移植到嵌入式上的科学计算器.34. 单片机实用子程序库.35. 学习嵌入式编程很好的软件查看工具.36. mp3c程序源码.37. dallas ID号芯片DS2401的读取.38. 简易频率计 里面包含有程序及仿真 还有电路原理图.39. 图像系统uc_GUI.40. 电子书.
上传时间: 2013-04-15
上传用户:eeworm
产品型号:VK2C21A/B/C/D 产品品牌:VINKA/永嘉微/永嘉微电 封装形式:SOP28/24/20/16 裸片:DICE(邦定COB)/COG(邦定玻璃用) 产品年份:新年份 联 系 人:许硕 原厂直销,工程服务,技术支持,价格最具优势!QT374 VK2C21A/B/C/D概述: VK2C21是一个点阵式存储映射的LCD驱动器,可支持最大80点(20SEGx4COM)或者最大128点(16SEGx8COM)的LCD屏。单片机可通过I2C接口配置显示参数和读写显示数据,也可通过指令进入省电模式。其高抗干扰,低功耗的特性适用于水电气表以及工控仪表类产品。 特点: ★ 工作电压 2.4-5.5V ★ 内置32 kHz RC振荡器 ★ 偏置电压(BIAS)可配置为1/3、1/4 ★ COM周期(DUTY)可配置为1/4、1/8 ★ 内置显示RAM为20x4位、16x8位 ★ 帧频可配置为80Hz、160Hz ★ 省电模式(通过关显示和关振荡器进入)
标签: LCD VK2C 抗干扰 21 高稳定 显示驱动 驱动 芯片
上传时间: 2022-04-08
上传用户:2937735731
产品型号:VK2C21A/B/C/D 产品品牌:VINKA/永嘉微/永嘉微电 封装形式:SOP28/24/20/16 裸片:DICE(邦定COB)/COG(邦定玻璃用) 产品年份:新年份 联 系 人:许硕 原厂直销,工程服务,技术支持,价格最具优势! VK2C21A/B/C/D概述: VK2C21是一个点阵式存储映射的LCD驱动器,可支持最大80点(20SEGx4COM)或者最大128点(16SEGx8COM)的LCD屏。单片机可通过I2C接口配置显示参数和读写显示数据,也可通过指令进入省电模式。其高抗干扰,低功耗的特性适用于水电气表以及工控仪表类产品。 特点: ★ 工作电压 2.4-5.5V ★ 内置32 kHz RC振荡器 ★ 偏置电压(BIAS)可配置为1/3、1/4 ★ COM周期(DUTY)可配置为1/4、1/8 ★ 内置显示RAM为20x4位、16x8位 ★ 帧频可配置为80Hz、160Hz ★ 省电模式(通过关显示和关振荡器进入)
标签: 21 VK2C C21 LCD VK2 VK 2C 存储器 多功能 映射
上传时间: 2022-04-08
上传用户:2937735731