DFA
Viết chương trình mô phỏng hoạt động của 1 DFA với một chuỗi nhập đầu vào.user_5119020710
python
2 years ago
623 B
15
Indexable
m, n = input().split() Q = list(map(int, input().split())) Input = input().split() acceptedState = list(map(int,input().split())) stateTrans={} for i in range (1,int(n)*int(m)+1): stateTransInput = input().split() state = {} state[stateTransInput[0]+' '+stateTransInput[1]] = int(stateTransInput[2]) stateTrans.update(state) test = input() currentState=0; for i in range(0,len(test)): if(test[i] in Input): currentState= stateTrans[str(currentState)+' '+str(test[i])] else: currentState = 999999 break if(currentState in acceptedState): print("YES") else: print("NO")
Editor is loading...