-
歐幾里德算法:輾轉(zhuǎn)求余 原理: gcd(a,b)=gcd(b,a mod b) 當(dāng)b為0時(shí),兩數(shù)的最大公約數(shù)即為a getchar()會接受前一個(gè)scanf的回車符
標(biāo)簽:
gcd
getchar
scanf
mod
上傳時(shí)間:
2014-01-10
上傳用戶:2467478207
-
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì) 數(shù)據(jù)結(jié)構(gòu)B+樹
B+ tree Library
標(biāo)簽:
Library
tree
數(shù)據(jù)結(jié)構(gòu)
樹
上傳時(shí)間:
2013-12-31
上傳用戶:semi1981
-
變量和相等問題的設(shè)計(jì)和實(shí)現(xiàn)將a、b、c、d、e、f這6個(gè)變量排成如圖所示的 三角形,這6個(gè)變量分別取 1——6的整數(shù),且均不相同。求使三角形三條邊上的變量之和相等的全部解,如 3
6 2
1 4 5
為一個(gè)解。
程序引入變量a,b,c,d,e,f,并讓它們分別取1——6的整數(shù),在它們互不相等的 條件下, 測試由它們排成如圖所示的三角形三條邊上的變量之和是否相等,如相等即為一種滿足要求的排列,把它們輸出。當(dāng)這些變量取盡所有的組合后,程序就可得到全部可能的解。
標(biāo)簽:
變量
三角形
上傳時(shí)間:
2015-11-04
上傳用戶:GavinNeko
-
1. 下列說法正確的是 ( )
A. Java語言不區(qū)分大小寫
B. Java程序以類為基本單位
C. JVM為Java虛擬機(jī)JVM的英文縮寫
D. 運(yùn)行Java程序需要先安裝JDK
2. 下列說法中錯(cuò)誤的是 ( )
A. Java語言是編譯執(zhí)行的
B. Java中使用了多進(jìn)程技術(shù)
C. Java的單行注視以//開頭
D. Java語言具有很高的安全性
3. 下面不屬于Java語言特點(diǎn)的一項(xiàng)是( )
A. 安全性
B. 分布式
C. 移植性
D. 編譯執(zhí)行
4. 下列語句中,正確的項(xiàng)是 ( )
A . int $e,a,b=10
B. char c,d=’a’
C. float e=0.0d
D. double c=0.0f
標(biāo)簽:
Java
A.
B.
C.
上傳時(shí)間:
2017-01-04
上傳用戶:netwolf
-
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
-
prolog 找路例子程序:
=== === === === === ===
Part 1-Adding connections
Part 2-Simple Path
example
| ?- path1(a,b,P,T).
will produce the response:
T = 15
P = [a,b] ?
Part 3 - Non-repeating path
As an example, the query:
?- path2(a,h,P,T).
will succeed and may produce the bindings:
P = [a,depot,b,d,e,f,h]
T = 155
Part 4 - Generating a path below a cost threshold
As an example, the query:
?- path_below_cost(a,[a,b,c,d,e,f,g,h],RS,300).
returns:
RS = [a,b,depot,c,d,e,g,f,h] ?
RS = [a,c,depot,b,d,e,g,f,h] ?
no
==================================
標(biāo)簽:
Part
connections
example
prolog
上傳時(shí)間:
2015-04-24
上傳用戶:ljt101007
-
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
標(biāo)簽:
government
streamline
important
alphabet
上傳時(shí)間:
2015-06-09
上傳用戶:weixiao99
-
* 高斯列主元素消去法求解矩陣方程AX=B,其中A是N*N的矩陣,B是N*M矩陣
* 輸入: n----方陣A的行數(shù)
* a----矩陣A
* m----矩陣B的列數(shù)
* b----矩陣B
* 輸出: det----矩陣A的行列式值
* a----A消元后的上三角矩陣
* b----矩陣方程的解X
標(biāo)簽:
矩陣
AX
高斯
元素
上傳時(shí)間:
2015-07-26
上傳用戶:xauthu
-
上下文無關(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
-
一:需求分析
1. 問題描述
魔王總是使用自己的一種非常精練而抽象的語言講話,沒人能聽懂,但他的語言是可逐步解釋成人能聽懂的語言,因?yàn)樗恼Z言是由以下兩種形式的規(guī)則由人的語言逐步抽象上去的:
-----------------------------------------------------------
(1) a---> (B1)(B2)....(Bm)
(2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o]
-----------------------------------------------------------
在這兩種形式中,從左到右均表示解釋.試寫一個(gè)魔王語言的解釋系統(tǒng),把
他的話解釋成人能聽得懂的話.
2. 基本要求:
用下述兩條具體規(guī)則和上述規(guī)則形式(2)實(shí)現(xiàn).設(shè)大寫字母表示魔王語言的詞匯 小寫字母表示人的語言的詞匯 希臘字母表示可以用大寫字母或小寫字母代換的變量.魔王語言可含人的詞匯.
(1) B --> tAdA
(2) A --> sae
3. 測試數(shù)據(jù):
B(ehnxgz)B 解釋成 tsaedsaeezegexenehetsaedsae若將小寫字母與漢字建立下表所示的對應(yīng)關(guān)系,則魔王說的話是:"天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝".
| t | d | s | a | e | z | g | x | n | h |
| 天 | 地 | 上 | 一只| 鵝 | 追 | 趕 | 下 | 蛋 | 恨 |
標(biāo)簽:
語言
抽象
分
上傳時(shí)間:
2014-12-02
上傳用戶:jkhjkh1982