源代碼\用動態(tài)規(guī)劃算法計算序列關(guān)系個數(shù) 用關(guān)系"<"和"="將3個數(shù)a,b,c依次序排列時,有13種不同的序列關(guān)系: 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個數(shù)依序列,設計一個動態(tài)規(guī)劃算法,計算出有多少種不同的序列關(guān)系, 要求算法只占用O(n),只耗時O(n*n).
標簽: lt 源代碼 動態(tài)規(guī)劃 序列
上傳時間: 2013-12-26
上傳用戶:siguazgb
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
上下文無關(guān)文法(Context-Free Grammar, CFG)是一個4元組G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一組有限的產(chǎn)生式規(guī)則集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素稱為非終結(jié)符,T的元素稱為終結(jié)符,S是一個特殊的非終結(jié)符,稱為文法開始符。 設G=(V, T, S, P)是一個CFG,則G產(chǎn)生的語言是所有可由G產(chǎn)生的字符串組成的集合,即L(G)={x∈T* | Sx}。一個語言L是上下文無關(guān)語言(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} 其中非終結(jié)符都是大寫字母,開始符都是S,終結(jié)符都是小寫字母。
標簽: 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("可傳遞閉包關(guān)系矩陣是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元關(guān)系的可傳遞閉包\n"); void warshall(int,int); int k , n; printf("請輸入矩陣的行數(shù) i: "); scanf("%d",&k); 四川大學實驗報告 printf("請輸入矩陣的列數(shù) 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<<"正在析構(gòu)中~~~~"<<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專區(qū)-嵌入式/單片機編程源碼精選合集系列(137)資源包含以下內(nèi)容:1. 可以從字庫中提取中文字的字模點陣信息,可分為12X12、14X14、16X16、24X24.2. ST Flash loader的2次開發(fā)接口源碼.3. C8051 IC SPEC資料,相信對于大家有幫助..4. SmartARM2214開發(fā)板原理圖.5. 關(guān)于spi的接口程序.6. arm嵌入式應用.7. 介紹PCB中的走線粗細與電流大小的關(guān)系..8. RC500讀寫源程序5[1].6.9. Spanion的關(guān)于NAND Flash的ECC算法的簡單比較.10. ecos cvs version lwip-tcpip nat addon patch..11. Embeded Software Development With eCos eCos必備之書.12. ZLG_GUI在uC_OS的使用.13. 看到的比較全面的Eclipse教程.14. TI TMS320C5509A開發(fā)板原理圖.15. 智能車開發(fā)板的原理圖.16. fat文件系統(tǒng)的源碼 老外寫的FAT32文件系統(tǒng) 還是有用的.17. 本文件系統(tǒng)實現(xiàn)的一個類似于DOS/WINDOWS的文件管理系統(tǒng).18. Atmega128單片機的LCD顯示 開發(fā)環(huán)境ICCAVR.19. 基于ZigBee通訊協(xié)議的設計與實現(xiàn).20. 嵌入式三星2410板子上實現(xiàn)通信服務。共分為接收端和發(fā)送端兩部分.21. 此程序是在blackfin下實在的ide硬盤的程序.22. GSM短信LED條屏控制板,STC單片機+29C040+62256.23. ST7920 控制器系列中文圖形液晶模塊顯示程序(C語言).24. 普林斯頓大學的本科嵌入式系統(tǒng)設計的講義。講述覆蓋了嵌入式設計的各個方面.25. P437_軍用軟件開發(fā)規(guī)范 P437_軍用軟件開發(fā)規(guī)范.26. wince 啟動時 自動加載 SD卡 應用程序.27. ,2006altera大賽-基于軟核Nios的寬譜正弦信號發(fā)生器設計:摘要:本設計運用了基于 Nios II 嵌入式處理器的 SOPC 技.28. 支持s3c4510的bios。感覺其實現(xiàn)的方式還是比較巧妙的。而且網(wǎng)上還有對該源碼的學習日志。很是有利于大家學習.29. 基于Nuleus操作系統(tǒng)和s3c4510的編寫的EFC。已經(jīng)包含了該EFC的設計說明。這是個實際產(chǎn)品的代碼.30. CPLD驅(qū)動顯示器的VGA口.31. 基于MFRC500讀卡芯片的完整讀卡程序.32. i2c introductions.33. 此文件為zigbee2006協(xié)議棧源碼.34. 基于QT60xx0的I2C接口開發(fā).35. STM32F10xxx USB開發(fā)者套件.36. 關(guān)于臺灣研華遠程以太網(wǎng)模塊上位機控制源代碼.37. 關(guān)于臺灣研華遠程以太網(wǎng)模塊上位機控制源代碼.38. 關(guān)于臺灣研華遠程以太網(wǎng)模塊上位機控制源代碼.39. 關(guān)于臺灣研華遠程以太網(wǎng)模塊上位機控制源代碼.40. 關(guān)于臺灣研華遠程以太網(wǎng)模塊上位機控制源代碼.
標簽: Demonstrator Release USB HID
上傳時間: 2013-04-15
上傳用戶:eeworm
專輯類-電子基礎類專輯-153冊-2.20G 21世紀大學新型參考教材系列-集成電路B-荒井-159頁-2.8M.pdf
上傳時間: 2013-05-16
上傳用戶:pkkkkp
1.增加的設備支持: Atmel AT91SAM9Rxx Cirrus Logic CS7401xx-IQZ Luminary Micro LM3S576x, LM3S5752, LM3S5747, LM3S573x, LM3S5662, LM3S5652, LM3S5632, LM3S3759, LM3S3749, and LM3S3739 NXP LPC32XX and LPC2460 STMicroelectronics STR912FAZ4X, STR912FAW4X, STR911FAW4X, STR911FAM4X, STR910FAW32, and STR910FAZ32 2.修改了NXP LPC23XX/24XX的頭文件庫 3.增加了ST-LINK II的調(diào)試支持 4.增加了對Cortex-M3 內(nèi)核芯片的RTX Event Viewer 的支持 5.增加了MCBSTM32: STM32 FLASH OPTION BYTES PROGRAMMING 6.增加了ULINK2對Cortex-M3的SWV功能的調(diào)試 7.增強了使用GNU在MDK下調(diào)試M1,M3,ARM7,ARM9的調(diào)試功能( Using μVision with CodeSourcery GNU ARM Toolchain.) 8.增加了大量經(jīng)典開發(fā)板例程 Boards目錄列表: ├─Embest 深圳市英蓓特公司開發(fā)板例程 │ ├─AT91EB40X-40008 │ ├─S3CEB2410 │ ├─ATEBSAM7S │ ├─LPC22EB06-I │ ├─LPCEB2000-A │ ├─LPCEB2000-B │ ├─LPCEB2000-S │ ├─str710 │ ├─str711 │ ├─str730 │ ├─str750 │ ├─STR912 │ ├─STM32V100 │ ├─STM32R100 │ ├─ATEB9200 ├─ADI ADI半導體的芯片例程 │ ├─ADuC702X │ └─ADuC712x ├─Atmel Atmel半導體的芯片例程 │ ├─AT91RM9200-EK │ ├─AT91SAM7A3-EK │ ├─AT91SAM7S-EK │ ├─AT91SAM7SE-EK │ ├─AT91SAM7X-EK │ ├─AT91SAM9260-EK │ ├─AT91SAM9261-EK │ ├─AT91SAM9263-EK ├─Keil Keil公司的開發(fā)板例程 │ ├─MCB2100 │ ├─MCB2103 │ ├─MCB2130 │ ├─MCB2140 │ ├─MCB2300 │ ├─MCB2400 │ ├─MCB2900 │ ├─MCBLM3S │ ├─MCBSTM32 │ ├─MCBSTR7 │ ├─MCBSTR730 │ ├─MCBSTR750 │ └─MCBSTR9 ├─Luminary Luminary半導體公司的芯片例程 │ ├─ek-lm3s1968 │ ├─ek-lm3s3748 │ ├─ek-lm3s3768 │ ├─dk-lm3s101 │ ├─dk-lm3s102 │ ├─dk-lm3s301 │ ├─dk-lm3s801 │ ├─dk-lm3s811 │ ├─dk-lm3s815 │ ├─dk-lm3s817 │ ├─dk-lm3s818 │ ├─dk-lm3s828 │ ├─ek-lm3s2965 │ ├─ek-lm3s6965 │ ├─ek-lm3s811 │ └─ek-lm3s8962 ├─NXP NXP半導體公司的芯片例程 │ ├─LH79524 │ ├─LH7A404 │ └─SJA2510 ├─OKI OKI半導體公司的芯片例程 │ ├─ML674000 │ ├─ML67Q4003 │ ├─ML67Q4051 │ ├─ML67Q4061 │ ├─ML67Q5003 │ └─ML69Q6203 ├─Samsung Samsung半導體公司的芯片例程 │ ├─S3C2440 │ ├─S3C44001 │ └─S3F4A0K ├─ST ST半導體公司的芯片例程 │ ├─CQ-STARM2 │ ├─EK-STM32F │ ├─STM32F10X_EVAL │ ├─STR710 │ ├─STR730 │ ├─STR750 │ ├─STR910 │ └─STR9_DONGLE ├─TI TI半導體公司的芯片例程 │ ├─TMS470R1A256 │ └─TMS470R1B1M ├─Winbond Winbond半導體公司的芯片例程 │ └─W90P710 └─ ...
上傳時間: 2013-10-13
上傳用戶:zhangliming420
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1