This is a stack of questions. I started to simulate the problem with arrays. I did not make the changes in the morning and finally gave up. Later, when I was working with the white gods, the white gods found the error, it's also my mistake, like 4 1234 2134... I understand, the middle can also be out of the stack.
Store the two strings first, and then stack them first. If the stack information is generated and the car to be output is located at the top of the stack, it can be output. Otherwise, go to the stack.
# Include <stdio. h> # include <string. h> int N, C, num1 [11], num2 [11], REC [11], L [11]; int main () {int I, j, CNT, k; while (scanf ("% d", & n) = 1) {c = 0; memset (REC, 0, sizeof (REC )); for (I = 0; I <n; ++ I) scanf ("% 1D", & num1 [I]); for (I = 0; I <N; ++ I) scanf ("% 1D", & num2 [I]); j = 0; CNT = I = c =-1; L [++ C] = num1 [++ I]; // import the first vehicle into the stack rec [++ CNT] = 0; while (I <n & J <n) {While (C> = 0 & L [c] = num2 [J ]) Rec [++ CNT] = 1, -- C, ++ J; // This car is on the top of the stack, you can get out of the car rec [++ CNT] = 0, L [++ C] = num1 [++ I]; // enter the vehicle} if (I = N & J = N) {// The REC value is 0 and the REC value is 1. "); For (k = 0; k <CNT; ++ K) puts (REC [k]? "Out": "in");} else puts ("no."); puts ("finish");} return 0 ;}