14/08/16 11:57:01.89 ceF43G6L.net
まあ、いいや。インデントなしで再投稿
enum State {q1,q2,q3};
set<State> Q={q1,q2,q3};
set<char> Σ={'0','1'};
map<pair<State,char>,State> δ={
(q1,'0')=>q1,
(q1,'1')=>q2,
(q2,'0')=>q3,
(q2,'1')=>q2,
(q3,'0')=>q2,
(q3,'1')=>q2
};
set<State> F={q2};
class Automaton {
set<State> Q;
set<char> Σ;
map<pair<State,char>,State> δ;
State start;
set<State> F;
bool accept(char *str){
State state=start;
while(str){
state=δ[(state,*str)];
str++;
}
return F.include(state);
}
} M = (Q,Σ,δ,q1,F);