当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1640:String Computer

题目描述
Extel have just brought out their newest computer, a string processing computer dubbed the X9091. It is hoped that it will have some value in cryptography and related fields. (It is rumoured that the Taiwanese are working on a clone that will correct Stage 1 essays, but we will ignore such vapourware). This computer will accept input strings and produce output strings from them, depending on the programs loaded into them at the time. The chip is the ultimate in RISC technology--it has only three transformation instructions:

Delete a character at a particular position.
Insert a character at a particular position.
Change the character at a particular position to a different character.

Programs for this machine are written in a form of machine code where each instruction has the format ZXdd--Z represents the code for the instruction (D, I or C), X is a character and dd represents a two digit number. A program is terminated by a special halt instruction consisting of the letter `E'. Note that each instruction works on the string in memory at the time the instruction is executed.

To see how this all works consider the following example. It is desired to transform the string `abcde' to the string `bcgfe'. This could be achieved by a series of Change commands, but is not minimal. The following program is better.


Write a program that will read in two strings (the input string and the target string) and will produce a minimal X9091 program necessary to transform the input string into the target string. Since there may be multiple solutions, only one should be produced. Any solution that satisfies these criteria will be accepted.
输入解释
Input will consist of a series of lines, each line containing two strings separated by exactly one space. The strings will consist of no more than 20 lower case characters. The file will be terminated by a line consisting of a single #.
输出解释
Output will consist of a series of lines, one for each line of the input. Each will consist of a program in X9091 language.
输入样例
abcde bcgfe
#
输出样例
Da01Cg03If04E
来自杭电HDUOJ的附加信息
Recommend linle

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 UVA

源链接: HDU-1640

最后修改于 2020-10-25T22:46:45+00:00 由爬虫自动更新

共提交 3

通过率 33.33%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)