地址:
题意:中文。。。
mark:生生递归就好了。
代码:
1 # include2 3 4 int num[4] ; 5 int pil[4][70] ; 6 int n ; 7 8 9 int judge(int a[70], int b[70], int c[70], int na, int nb, int nc)10 {11 // printf ("%d\n", n) ;12 if (n == 0) return 1 ;13 if (na <= a[0] && a[na] == n)14 {15 n-- ;16 return judge (a, c, b, na+1, nc, nb) ;17 }18 else if (nc <= c[0] && c[nc] == n)19 {20 n-- ;21 return judge (b, a, c, nb, na, nc+1) ;22 }23 return 0 ;24 }25 26 27 int main ()28 {29 int T, i, j ;30 scanf ("%d", &T) ;31 while (T--)32 {33 scanf ("%d", &n) ;34 for (i = 0 ; i < 3 ; i++)35 {36 scanf ("%d", &pil[i][0]) ;37 // n += pil[i][0] ;38 for (j = 1 ; j <= pil[i][0] ; j++)39 scanf ("%d", &pil[i][j]) ;40 }41 puts (judge(pil[0], pil[1], pil[2], 1, 1, 1) ? "true" : "false") ;42 }43 return 0 ;44 }