Untitled
unknown
plain_text
2 years ago
3.2 kB
1
Indexable
Never
#include <iostream> using namespace std; #define find find228 const int start = 1; const int sr_this = 2; const int move_to_sr = 3; const int bring_ok = 3; const int new_word_a = 4; const int new_word_b = 5; const int find_word_to_check_a = 6; const int find_word_to_check_b = 7; const int move_to_minus = 8; const int q_0 = 9; const int q_1 = 10; const int q_2 = 11; const int bring_bad = 12; const int move_to_sr_back = 13; const int finish = 0; void move(int state, char c1, int new_state, char c2, int move) { cout << state << " " << c1 << " " << new_state << " " << c2 << " " << move << '\n'; } void solve() { move(start, '0', start, '0', 1); move(start, '1', start, '1', 1); move(start, '_', sr_this, 'w', 1); move(move_to_sr, '_',bring_ok, '_', 1); move(move_to_sr, '0',move_to_sr, '0', 1); move(move_to_sr, '1',move_to_sr, '1', 1); move(move_to_sr, 'w',move_to_sr, 'w', 1); move(move_to_sr, 'a',sr_this, 'a', 0); move(move_to_sr, 'b',sr_this, 'b', 0); move(move_to_sr, '~',move_to_sr, '~', 1); move(move_to_sr_back, '_',move_to_sr_back, '_', -1); move(move_to_sr_back, 'w',bring_ok, 'w', 1); move(move_to_sr_back, 'a',move_to_sr_back, 'a', -1); move(move_to_sr_back, 'b',move_to_sr_back, 'b', -1); move(move_to_sr_back, '~',sr_this, '~', 1); move(sr_this, 'a',new_word_a, '~', 1); move(sr_this, '_',bring_ok, '_', 1); move(sr_this, 'b',new_word_b, '~', 1); move(new_word_a, 'a',new_word_a, 'a', 1); move(new_word_a, 'b',new_word_a, 'b', 1); move(new_word_a, '_',find_word_to_check_a, '_', 1); move(new_word_b, 'a',new_word_b, 'a', 1); move(new_word_b, 'b',new_word_b, 'b', 1); move(new_word_b, '_',find_word_to_check_b, '_', 1); move(find_word_to_check_b, '~',find_word_to_check_b, '~', 1); move(find_word_to_check_a, '~',find_word_to_check_a, '~', 1); move(find_word_to_check_b, 'b',move_to_sr_back, '~', -1); move(find_word_to_check_b, 'a',move_to_minus, '~', -1); move(find_word_to_check_a, 'a',move_to_sr_back, '~', -1); move(find_word_to_check_a, 'b',move_to_minus, '~', -1); move(move_to_minus, 'b',move_to_minus, 'b', -1); move(move_to_minus, 'a',move_to_minus, 'a', -1); move(move_to_minus, '_',move_to_minus, '_', -1); move(move_to_minus, '~',move_to_minus, '~', -1); move(move_to_minus, 'w',q_1, 'w', -1); move(q_1,'1',q_2,'0',-1); move(q_1,'0',q_1,'1',-1); move(q_1,'!',bring_bad,'!',1); move(q_2,'0',q_2,'0',-1); move(q_2,'1',q_2,'1',-1); move(q_2,'!',move_to_sr,'!',1); move(bring_ok, '_',bring_ok, '_', 1); move(bring_ok, 'a',bring_ok, 'a', 1); move(bring_ok, 'b',bring_ok, 'b', 1); move(bring_ok, '~',bring_ok, '~', 1); move(bring_ok, 'w',bring_ok, 'w', 1); move(bring_ok, '!',finish, '1', 0); move(bring_bad, '_',bring_bad, '_', 1); move(bring_bad, 'a',bring_bad, 'a', 1); move(bring_bad, 'b',bring_bad, 'b', 1); move(bring_bad, '~',bring_bad, '~', 1); move(bring_bad, 'w',bring_bad, 'w', 1); move(bring_bad, '!',finish, '0', 0); } signed main() { solve(); return 0; }