魔王語言解釋
[問題描述]
有一個(gè)魔王總是使用自己的一種非常精練而又抽象的語言講話,沒有人能聽得懂,但他的語言是可以逐步解釋成人能聽懂的語言,因?yàn)樗恼Z言是由以下兩種形式的規(guī)則由人的語言逐步抽象上去的:
(1) α 轉(zhuǎn)換為 β1β2…βm
(2) (θδ1δ2…δn) 轉(zhuǎn)換為 θδnθδn-1… θδ1θ
在這兩種形式重,從左到右均表示解釋。試寫一個(gè)魔王語言的解釋兄,把他的話解釋成人能聽得懂的話。
[基本要求]
用下述兩條具體規(guī)則和上述規(guī)則形式(2)實(shí)現(xiàn)。設(shè)大寫字母表示魔王語言的詞匯;小寫字母表示人的語言詞匯;希臘字母表示可以用大寫字母或小寫字母代換的變量。魔王語言可含人的詞匯。
(1)B 轉(zhuǎn)換為 tAdA
(2)A 轉(zhuǎn)換為 sae
[測試數(shù)據(jù)]
B(exnxgz)B解釋成tsaedsaeezegexenehetsaedsae
若將小寫字母與漢字建立下表所示的對應(yīng)關(guān)系,則魔王說的話是:“天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一直鵝地上一只鵝”。
t d s a e z g x n h
天 地 上 一只 鵝 追 趕 下 蛋 恨
加密算法
Test Driver for Crypto++, a C++ Class Library of Cryptographic Primitives:
- To generate an RSA key
cryptest g
- To encrypt and decrypt a string using RSA
cryptest r
- To calculate MD5, SHS, and RIPEMD-160 message digests:
cryptest m file
- To encrypt and decrypt a string using DES-EDE in CBC mode:
cryptest t
- To encrypt or decrypt a file
cryptest e|d input output
- To share a file into shadows:
cryptest s <pieces> <pieces-needed> file
(make sure file has no extension, if you re running this under DOS)
- To reconstruct a file from shadows:
cryptest j output file1 file2 [....]
- To gzip a file:
cryptest z <compression-level> input output
- To gunzip a file:
cryptest u input output
- To run validation tests:
cryptest v
- To run benchmarks:
cryptest b [time for each benchmark in seconds]
/*
* EULER S ALGORITHM 5.1
*
* TO APPROXIMATE THE SOLUTION OF THE INITIAL VALUE PROBLEM:
* Y = F(T,Y), A<=T<=B, Y(A) = ALPHA,
* AT N+1 EQUALLY SPACED POINTS IN THE INTERVAL [A,B].
*
* INPUT: ENDPOINTS A,B INITIAL CONDITION ALPHA INTEGER N.
*
* OUTPUT: APPROXIMATION W TO Y AT THE (N+1) VALUES OF T.
*/
BNB20 Finds the constrained minimum of a function of several possibly integer variables.
% Usage: [errmsg,Z,X,t,c,fail] =
% BNB20(fun,x0,xstatus,xlb,xub,A,B,Aeq,Beq,nonlcon,settings,options,P1,P2,...)
%
% BNB solves problems of the form:
% Minimize F(x) subject to: xlb <= x0 <=xub
% A*x <= B Aeq*x=Beq
% C(x)<=0 Ceq(x)=0
% x(i) is continuous for xstatus(i)=0
% x(i) integer for xstatus(i)= 1
% x(i) fixed for xstatus(i)=2
%