# Include <stdio. h> # include <stdbool. h> # include <stdlib. h> # include "Sv. H "Void module (struct vector [], INT); bool test (INT, Int, INT); void Delete (void); void addnew (INT, Int, INT ); void findout (void); int persons, capcity; s_node * Final = NULL; int main (void) {printf ("input the number of traders (just equal # servants ): "); scanf (" % d ", & persons); getchar (); printf (" the boat can rive persons: "); scanf (" % d ", & Cap City); getchar (); s_node s_first = {. X = Persons ,. y = Persons ,. tst_cnt = 0 ,. dir = 1 ,. pre = NULL ,}; final = & s_first; int ways = capcity + (capcity + 1) * capcity/2; struct vector u [ways]; int K = 0; for (INT I = 0; I <= capcity; I ++) for (Int J = 0; j <= capcity; j ++) if (I + j <= capcity & I + j> 0) {u [K]. V = I; U [k ++]. W = J;} module (u, ways); Return 0;} void module (struct vector u [], int N) {While (true ){/ /Stop moduleif (Final-> X = 0 & final-> Y = 0) {findout (); break ;} else if (Final-> pre = NULL & final-> tst_cnt = N) {printf ("No method, well, that is you failed !!!!!!!!!! \ N "); break;} // continue moduleif (Final-> tst_cnt = N) {Delete (); continue ;} int trader = final-> X-(Final-> DIR) * U [Final-> tst_cnt]. v; int servant = final-> Y-(Final-> DIR) * U [Final-> tst_cnt]. w; int Director =-(Final-> DIR); If (test (trader, servant, Director) {addnew (trader, servant, Director); Continue ;}}} void findout (void) {s_node * iterate = final; while (iterate! = NULL) {printf ("(% d, % d) <-", iterate-> X, iterate-> Y); iterate = iterate-> pre ;} printf ("Start \ n"); printf ("yes, you succeed !!!! \ N ");} bool test (int t, int S, int d) {final-> tst_cnt ++; if (T <0 | T> Persons | S <0 | S> Persons) return false; if (t = 0 | T = S | T = Persons) {s_node * iterate = final; while (iterate! = NULL) {If (iterate-> X = T & iterate-> Y = S & iterate-> dir = d) return false; iterate = iterate-> pre;} return true;} elsereturn false;} void Delete (void) {s_node * newptr = final; Final = final-> pre; free (newptr);} void addnew (int t, int S, int d) {s_node * newptr = malloc (sizeof (s_node); newptr-> X = T; newptr-> Y = s; newptr-> dir = D; newptr-> tst_cnt = 0; newptr-> pre = final; Final = newptr;} Here is the declaration of the relevant structure.