Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:题目的样例怎么理解?

Posted by jieshuzheng at 2008-08-20 17:54:06 on Problem 1373
In Reply To:题目的样例怎么理解? Posted by:wrong123 at 2005-12-24 22:36:25
> w = aa
> s1= bb
> s2= ab
> z = aaabb
> 这一组数据,我是这么理解它的一次操作:  遍历w,碰到a就用s1替换,碰到b就用s2替换。
> 所以,对于这一组数据的第一次操作就是:w 的两个a被s1替换了,变成了bbbb
> 第二次操作:就变成了 abababab,所以就不能变成z了
> 
> 晕,这样理解肯定错的,但是我找不到怎么样替换才能转成 z  ....
> 
productions:
a -> aa
b -> bb

initial string:
ab

first change all 'a's to aa
ab ---> aab
then change all 'b's to bb
aab ---> aabb
then change all 'a' to aa
aabb ---> aaaabb

now the string "aaabb" can match "aaaabb" with a prefix of "a" and a suffix   of "" from SIGMA*

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator