C language source code: [cpp] # include <stdio. h> # include <stdlib. h> # define maxsize 510 int E [maxsize] [maxsize]; int q [maxsize * 2]; int indegree [maxsize]; int cmp (const void *, const void * B) {return * (int *) a-* (int *) B;} int main () {int m, n, a, B, I, j, num, front, rear; while (scanf ("% d", & n, & m )! = EOF) {www.2cto.com for (I = 0; I <n; I ++) {indegree [I] = 0; for (j = 0; j <n; j ++) E [I] [j] = 0 ;}while (m> 0) {m --; scanf ("% d", &, & B); if (E [A-1] [b-1]! = 1) {E [A-1] [b-1] = 1; indegree [b-1] + = 1;} // This question has a trap, assume that one pair wins the other several times...} Front = 0; rear = 0; for (I = 0; I <n; I ++) {if (indegree [I] = 0) q [rear ++] = I;} qsort (q, rear, sizeof (q [0]), cmp); num = 1; while (front! = Rear) {I = q [front ++]; if (num! = N) printf ("% d", I + 1); else {printf ("% d \ n", I + 1); break;} num ++; for (j = 0; j <n; j ++) {if (E [I] [j]! = 0) {indegree [j] --; if (indegree [j] = 0) q [rear ++] = j ;}} qsort (& q [front], rear-front, sizeof (q [front]), cmp );}}}