-
RSA算法 :首先, 找出三個(gè)數(shù), p, q, r, 其中 p, q 是兩個(gè)相異的質(zhì)數(shù), r 是與 (p-1)(q-1) 互質(zhì)的數(shù)...... p, q, r 這三個(gè)數(shù)便是 person_key,接著, 找出 m, 使得 r^m == 1 mod (p-1)(q-1)..... 這個(gè) m 一定存在, 因?yàn)?r 與 (p-1)(q-1) 互質(zhì), 用輾轉(zhuǎn)相除法就可以得到了..... 再來, 計(jì)算 n = pq....... m, n 這兩個(gè)數(shù)便是 public_key ,編碼過程是, 若資料為 a, 將其看成是一個(gè)大整數(shù), 假設(shè) a < n.... 如果 a >= n 的話, 就將 a 表成 s 進(jìn)位 (s
標(biāo)簽:
person_key
RSA
算法
上傳時(shí)間:
2013-12-14
上傳用戶:zhuyibin
-
大整數(shù)乘法例子代碼
/* 遞歸邊界,如果是1位二進(jìn)制數(shù)與1位二進(jìn)制數(shù)相乘,則可以直接計(jì)算 */
/*累計(jì)做1位二進(jìn)制乘法運(yùn)算的次數(shù)*/
/* return (X*Y) */
/* 計(jì)算n的值 */
/* 把X和Y拆分開來,令X=A*2^(n/2)+B, 左移位運(yùn)算,mod = 1<<(n/2) */
/* 計(jì)算XY=AC*2^n+(AD+CB)*2^(n/2)+BD */
/* 計(jì)算A*C,再向左移n位 */
/* 遞歸計(jì)算A*D */
/* 遞歸計(jì)算C*B */
/* 計(jì)算a21+a22,再向左移n/2位 */
/* 遞歸計(jì)算B*D */
/* XY=a1+a2+a3 */
標(biāo)簽:
整數(shù)
乘法
代碼
遞歸
上傳時(shí)間:
2015-05-19
上傳用戶:gyq
-
數(shù)字運(yùn)算,判斷一個(gè)數(shù)是否接近素?cái)?shù)
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
標(biāo)簽:
數(shù)字
運(yùn)算
上傳時(shí)間:
2015-05-21
上傳用戶:daguda
-
LCS(最長(zhǎng)公共子序列)問題可以簡(jiǎn)單地描述如下:
一個(gè)給定序列的子序列是在該序列中刪去若干元素后得到的序列。給定兩個(gè)序列X和Y,當(dāng)另一序列Z既是X的子序列又是Y的子序列時(shí),稱Z是序列X和Y的公共子序列。例如,若X={A,B,C,B,D,B,A},Y={B,D,C,A,B,A},則序列{B,C,A}是X和Y的一個(gè)公共子序列,但它不是X和Y的一個(gè)最長(zhǎng)公共子序列。序列{B,C,B,A}也是X和Y的一個(gè)公共子序列,它的長(zhǎng)度為4,而且它是X和Y的一個(gè)最長(zhǎng)公共子序列,因?yàn)閄和Y沒有長(zhǎng)度大于4的公共子序列。
最長(zhǎng)公共子序列問題就是給定兩個(gè)序列X={x1,x2,...xm}和Y={y1,y2,...yn},找出X和Y的一個(gè)最長(zhǎng)公共子序列。對(duì)于這個(gè)問題比較容易想到的算法是窮舉,對(duì)X的所有子序列,檢查它是否也是Y的子序列,從而確定它是否為X和Y的公共子序列,并且在檢查過程中記錄最長(zhǎng)的公共子序列。X的所有子序列都檢查過后即可求出X和Y的最長(zhǎng)公共子序列。X的每個(gè)子序列相應(yīng)于下標(biāo)集{1,2,...,m}的一個(gè)子集。因此,共有2^m個(gè)不同子序列,從而窮舉搜索法需要指數(shù)時(shí)間。
標(biāo)簽:
序列
LCS
元素
上傳時(shí)間:
2015-06-09
上傳用戶:氣溫達(dá)上千萬的
-
電力系統(tǒng)在臺(tái)穩(wěn)定計(jì)算式電力系統(tǒng)不正常運(yùn)行方式的一種計(jì)算。它的任務(wù)是已知電力系統(tǒng)某一正常運(yùn)行狀態(tài)和受到某種擾動(dòng),計(jì)算電力系統(tǒng)所有發(fā)電機(jī)能否同步運(yùn)行
1運(yùn)行說明:
請(qǐng)輸入初始功率S0,形如a+bi
請(qǐng)輸入無限大系統(tǒng)母線電壓V0
請(qǐng)輸入系統(tǒng)等值電抗矩陣B
矩陣B有以下元素組成的行矩陣
1正常運(yùn)行時(shí)的系統(tǒng)直軸等值電抗Xd
2故障運(yùn)行時(shí)的系統(tǒng)直軸等值電抗X d
3故障切除后的系統(tǒng)直軸等值電抗
請(qǐng)輸入慣性時(shí)間常數(shù)Tj
請(qǐng)輸入時(shí)段數(shù)N
請(qǐng)輸入哪個(gè)時(shí)段發(fā)生故障Ni
請(qǐng)輸入每時(shí)段間隔的時(shí)間dt
標(biāo)簽:
電力系統(tǒng)
正
計(jì)算
運(yùn)行
上傳時(shí)間:
2015-06-13
上傳用戶:it男一枚
-
光學(xué)設(shè)計(jì)軟件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.
標(biāo)簽:
described
aspheric
surfaces
Annular
上傳時(shí)間:
2014-01-08
上傳用戶:yyyyyyyyyy
-
1 概述
1.1 編寫目的
本文檔的編寫目的是:詳細(xì)定義×××××軟件的總體功能;給出系統(tǒng)的結(jié)構(gòu)設(shè)計(jì),作為過程設(shè)計(jì)和程序編寫的依據(jù)。
1.2 參考資料
包括:
a. 項(xiàng)目來源;
b. 本文檔中引用到的規(guī)范和資料等;
c. 列出這些規(guī)范和資料的作者、編號(hào)、標(biāo)題、發(fā)表日期、出版單位或資料來源。
1.3 術(shù)語和縮寫詞*
列出本文檔中用到的專門術(shù)語的定義和縮寫詞,縮寫詞要給出中文譯名和英文全稱,常用的不需要定義。
2 需求概述
2.1 目標(biāo)與需求
概述系統(tǒng)的特性和需求,擴(kuò)充軟件需求說明中的信息,給出增加的細(xì)節(jié),詳盡地指出對(duì)軟件需求說明中有關(guān)特性和需求做出的變更。
2.2 環(huán)境描述
描述運(yùn)行軟件系統(tǒng)所需的軟、硬件環(huán)境;描述開發(fā)軟件系統(tǒng)所需的軟、硬件環(huán)境。
2.3 條件和限制
描述可能影響設(shè)計(jì)方案形成及實(shí)施的條件和限制。
標(biāo)簽:
1.1
編寫
文檔
定義
上傳時(shí)間:
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
標(biāo)簽:
L.
published
Schwartz
Edition
上傳時(shí)間:
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
標(biāo)簽:
L.
published
Schwartz
Edition
上傳時(shí)間:
2015-09-03
上傳用戶:lifangyuan12
-
上下文無關(guān)文法(Context-Free Grammar, CFG)是一個(gè)4元組G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一組有限的產(chǎn)生式規(guī)則集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素稱為非終結(jié)符,T的元素稱為終結(jié)符,S是一個(gè)特殊的非終結(jié)符,稱為文法開始符。
設(shè)G=(V, T, S, P)是一個(gè)CFG,則G產(chǎn)生的語言是所有可由G產(chǎn)生的字符串組成的集合,即L(G)={x∈T* | Sx}。一個(gè)語言L是上下文無關(guān)語言(Context-Free Language, CFL),當(dāng)且僅當(dāng)存在一個(gè)CFG G,使得L=L(G)。 *⇒
例如,設(shè)文法G:S→AB
A→aA|a
B→bB|b
則L(G)={a^nb^m | n,m>=1}
其中非終結(jié)符都是大寫字母,開始符都是S,終結(jié)符都是小寫字母。
標(biāo)簽:
Context-Free
Grammar
CFG
上傳時(shí)間:
2013-12-10
上傳用戶:gaojiao1999