Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这道题连自动机都用不着,更用不着递归.右线性文法,从右往左扫一次字符串,边扫边进行规约即可. 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator