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

这道题连自动机都用不着,更用不着递归.

Posted by shiqicai at 2010-03-06 20:03:34 on Problem 1126
右线性文法,从右往左扫一次字符串,边扫边进行规约即可.
while(i--)
  {	
    temp=str[i];
    if(temp<='z' && temp>='p')    
      count++;		
    else if(temp=='C' || temp=='D' || temp=='E' || temp=='I')
    {				
        count--;
	if(count<1)
	    break;
    }
    else if(temp=='N')
    {
        if(count<1)
	    break;
    }
    else
    {
        count=-1;
        break;
    }
  }

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