大整數乘法例子代碼 /* 遞歸邊界,如果是1位二進制數與1位二進制數相乘,則可以直接計算 */ /*累計做1位二進制乘法運算的次數*/ /* return (X*Y) */ /* 計算n的值 */ /* 把X和Y拆分開來,令X=A*2^(n/2)+B, 左移位運算,mod = 1<<(n/2) */ /* 計算XY=AC*2^n+(AD+CB)*2^(n/2)+BD */ /* 計算A*C,再向左移n位 */ /* 遞歸計算A*D */ /* 遞歸計算C*B */ /* 計算a21+a22,再向左移n/2位 */ /* 遞歸計算B*D */ /* XY=a1+a2+a3 */
上傳時間: 2015-05-19
上傳用戶:gyq
數字運算,判斷一個數是否接近素數 A Niven number is a number such that the sum of its digits divides itself. For example, 111 is a Niven number because the sum of its digits is 3, which divides 111. We can also specify a number in another base b, and a number in base b is a Niven number if the sum of its digits divides its value. Given b (2 <= b <= 10) and a number in base b, determine whether it is a Niven number or not. Input Each line of input contains the base b, followed by a string of digits representing a positive integer in that base. There are no leading zeroes. The input is terminated by a line consisting of 0 alone. Output For each case, print "yes" on a line if the given number is a Niven number, and "no" otherwise. Sample Input 10 111 2 110 10 123 6 1000 8 2314 0 Sample Output yes yes no yes no
上傳時間: 2015-05-21
上傳用戶:daguda
LCS(最長公共子序列)問題可以簡單地描述如下: 一個給定序列的子序列是在該序列中刪去若干元素后得到的序列。給定兩個序列X和Y,當另一序列Z既是X的子序列又是Y的子序列時,稱Z是序列X和Y的公共子序列。例如,若X={A,B,C,B,D,B,A},Y={B,D,C,A,B,A},則序列{B,C,A}是X和Y的一個公共子序列,但它不是X和Y的一個最長公共子序列。序列{B,C,B,A}也是X和Y的一個公共子序列,它的長度為4,而且它是X和Y的一個最長公共子序列,因為X和Y沒有長度大于4的公共子序列。 最長公共子序列問題就是給定兩個序列X={x1,x2,...xm}和Y={y1,y2,...yn},找出X和Y的一個最長公共子序列。對于這個問題比較容易想到的算法是窮舉,對X的所有子序列,檢查它是否也是Y的子序列,從而確定它是否為X和Y的公共子序列,并且在檢查過程中記錄最長的公共子序列。X的所有子序列都檢查過后即可求出X和Y的最長公共子序列。X的每個子序列相應于下標集{1,2,...,m}的一個子集。因此,共有2^m個不同子序列,從而窮舉搜索法需要指數時間。
上傳時間: 2015-06-09
上傳用戶:氣溫達上千萬的
光學設計軟件zemax源碼: This DLL models an nular aspheric surface as described in: "Annular surfaces in annular field systems" By Jose M. Sasian Opt. eng. 36 (12) P 3401-3401 December 1997 This surface is essentially an odd aspheric surface with an offset in the aspheric terms. The sag is given by: Z = (c*r*r) / (1+(1-((1+k)*c*c*r*r))^ 1/2 ) + a*(r-q)^2 + b*(r-q)^3 + c*(r-q)^4 + ... Note the terms a, b, c, ... have units of length to the -1, -2, -3, ... power.
標簽: described aspheric surfaces Annular
上傳時間: 2014-01-08
上傳用戶:yyyyyyyyyy
1 概述 1.1 編寫目的 本文檔的編寫目的是:詳細定義×××××軟件的總體功能;給出系統(tǒng)的結構設計,作為過程設計和程序編寫的依據。 1.2 參考資料 包括: a. 項目來源; b. 本文檔中引用到的規(guī)范和資料等; c. 列出這些規(guī)范和資料的作者、編號、標題、發(fā)表日期、出版單位或資料來源。 1.3 術語和縮寫詞* 列出本文檔中用到的專門術語的定義和縮寫詞,縮寫詞要給出中文譯名和英文全稱,常用的不需要定義。 2 需求概述 2.1 目標與需求 概述系統(tǒng)的特性和需求,擴充軟件需求說明中的信息,給出增加的細節(jié),詳盡地指出對軟件需求說明中有關特性和需求做出的變更。 2.2 環(huán)境描述 描述運行軟件系統(tǒng)所需的軟、硬件環(huán)境;描述開發(fā)軟件系統(tǒng)所需的軟、硬件環(huán)境。 2.3 條件和限制 描述可能影響設計方案形成及實施的條件和限制。
上傳時間: 2013-12-18
上傳用戶:stvnash
by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 Third Edition, published July 2001. (See the catalog page for this book.) the text of Learning Perl, 3rd Edition. Table of Contents Copyright Page Preface Chapter 1: Introduction Chapter 2: Scalar Data Chapter 3: Lists and Arrays Chapter 4: Subroutines Chapter 5: Hashes Chapter 6: I/O Basics Chapter 7: Concepts of Regular Expressions Chapter 8: More About Regular Expressions Chapter 9: Using Regular Expressions Chapter 10: More Control Structures Chapter 11: Filehandles and File Tests Chapter 12: Directory Operations Chapter 13: Manipulating Files and Directories Chapter 14: Process Management Chapter 15: Strings and Sorting Chapter 16: Simple Databases Chapter 17: Some Advanced Perl Techniques Appendix A: Exercise Answers Appendix B: Beyond the Llama Index Colophon
標簽: L. published Schwartz Edition
上傳時間: 2014-11-29
上傳用戶:kr770906
by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 Third Edition, published July 2001. (See the catalog page for this book.) Learning Perl, 3rd Edition. Table of Contents Copyright Page Preface Chapter 1: Introduction Chapter 2: Scalar Data Chapter 3: Lists and Arrays Chapter 4: Subroutines Chapter 5: Hashes Chapter 6: I/O Basics Chapter 7: Concepts of Regular Expressions Chapter 8: More About Regular Expressions Chapter 9: Using Regular Expressions Chapter 10: More Control Structures Chapter 11: Filehandles and File Tests Chapter 12: Directory Operations Chapter 13: Manipulating Files and Directories Chapter 14: Process Management Chapter 15: Strings and Sorting Chapter 16: Simple Databases Chapter 17: Some Advanced Perl Techniques Appendix A: Exercise Answers Appendix B: Beyond the Llama Index Colophon
標簽: L. published Schwartz Edition
上傳時間: 2015-09-03
上傳用戶:lifangyuan12
設計一個字節(jié)(8 位)比較器。 要求:比較兩個字節(jié)的大小,如a[7:0]大于 b[7:0]輸出高電平,否則輸出低電平,改寫測試 模型,使其能進行比較全面的測試 。
上傳時間: 2015-11-07
上傳用戶:manking0408
三相步進電機的三相六拍工作方式,正轉的繞組通電順序:A、AB、B、BC、C、CA、A,反轉的通電順序:A、AC、C、CB、B、BA、B、A。 由于步進電機轉子有一定的慣性以及所帶負載的慣性,故步進電機的工作過程中不能及時的啟動和停止,在啟動時應慢慢的加速到預定速度,在停止前應逐漸減速到停止,否則,將產生失步現象。 步進電機的控制問題可總結為兩點: 1、產生工作方式需要的時序脈沖; 2、控制步進電機的速度,使它始終遵循加速、勻速、減速的規(guī)律工作。
上傳時間: 2015-12-01
上傳用戶:685
java寫的圍棋游戲小程序 開發(fā)思路 調用applet類作為父類。在init事件中調用Qipan類,作出panel,上加控制用控件。在paint事件里調用drawline函數畫棋盤,注冊鼠標動作。鼠標單擊位置上用drawoval畫出棋子, 事件處理過程 A。重新開始 B。選擇尺寸 C。悔棋事件 D。前進事件 有三個文件Weiqi.java,Qizi.java,Qipan.java
上傳時間: 2014-01-07
上傳用戶:gyq