This is suitable for comrades who just got started with binary matching. 0 .-!
I won't talk about the meaning of the question. I mainly want to talk about the problem of zengguang road. In fact, it is also quite understandable from zengguang Road, why did you find a way to satisfy your previous questions and find a way to meet your needs?
In fact, the new knowledge point is the concept of saving the road. the path is not always fixed. If there is better, we still need to update it. I think this is the essence of zengguang Road?
Paste the Code:
# Include <stdio. h> # include <string. h> # include <stdlib. h> # include <math. h> int n, m, K; int map [505] [505]; int link [505]; int visit [505]; int getnum (int x) {for (INT I = 1; I <= m; I ++) {If (! Visit [I] & map [x] [I]) {visit [I] = 1; if (! Link [I] | getnum (link [I]) {link [I] = x; return 1 ;}} return 0 ;}int main () {While (scanf ("% d", & K), k) {scanf ("% d", & N, & M); int COUNT = 0; int A, B; memset (MAP, 0, sizeof (MAP); memset (link, 0, sizeof (Link); For (INT I = 1; I <= K; I ++) {scanf ("% d", & A, & B); map [a] [B] = 1 ;} for (Int J = 1; j <= N; j ++) {memset (visit, 0, sizeof (visit); If (getnum (j )) count ++;} printf ("% d \ n", count);} return 0 ;}