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